how to calculate relative extrema?



> From: Adam Christopher Lawrence
> I'm an adult student who's trying to do some homework using 
> Maxima, as I 
> cannot afford the time to commute 20km to the university 
> campus to use 
> their Maple workstations after work hours.
> 
> Several fruitless hours of searching through the 
> documentation and the 
> Internet in general has left me very puzzled. Maxima - 
> seemingly - has 
> no mechanism for calculating the relative extrema of a 
> polynomial over a 
> given range. Other posts implied that a function 'lbfgs' can do this 
> function, but the language in the help file for this function seems 
> targeted to PhD candidates, as I cannot make heads or tails out of it.
> 
> So, experts: say you have a fourth-order function like f(x):=10x^4 - 
> 3x^3 + 2x^2 -6x + 1. Is there any command for finding the minimum and 
> maximum values of this function over a specified range? Is there no 
> equivalent to the Maple "maximize" and "minimize" functions? 
> If 'lbfgs' 
> is the only way to do so, can someone provide a plain-English 
> explanation as to how this function works?

You could start with

(%i1) f(x):=10*x^4 -3*x^3 + 2*x^2 -6*x + 1;
(%o1) f(x):=10*x^4-3*x^3+2*x^2+(-6)*x+1

Graph it to see what it looks like.

Here is the symbolic derivative

(%i2) df(x):=''(diff(f(x),x));
(%o2) df(x):=40*x^3-9*x^2+4*x-6

You can find the roots f(x)=0, where it crosses the x axis,

(%i5) allroots(f(x));
(%o5) [x=0.17584913313648,x=0.77511823365767*%i-0.33623078026485,x=-0.77511823365767*%i-0.33623078026485,x=0.79661242739322]

and the local extrema when df/dx = 0

(%i6) allroots(df(x));
(%o6) [x=0.54560534722001,x=0.49922644623863*%i-0.16030267361,x=-0.49922644623863*%i-0.16030267361]

As f(x) is continous then the extrema will be at the local extrema
or at the ends of the interval.  There is only one local extrema x1.

(%i9) x1:rhs(%o6[1]);
(%o9) 0.54560534722001

Over the interval a <= x <= b we have

(%i10) a:-1;
(%o10) -1
(%i11) b:1;
(%o11) 1
(%i12) max(f(a),f(b),f(x1));
(%o12) 22
(%i13) min(f(a),f(b),f(x1));
(%o13) -1.279352843175381

and of course the second derivative is positive at x=x1 so it is a 
local minima, and as f is a quartic then it must also be the global 
minimum

(%i14) ddf(x):=''(diff(f(x),x,2));
(%o14) ddf(x):=120*x^2-18*x+4
(%i15) ddf(x1);
(%o15) 29.90132713984755


NOTICE
This e-mail and any attachments are private and confidential and may contain privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments.
This notice should not be removed.