Function: math[extrema] - determines extrema of a function in one real variable
Calling Sequence:
extrema(f, x);
extrema(f, x, options);
extrema(f, x=a .. b);
extrema(f, x=a .. b, options);
Parameters:
f
- an algebraic expression in x
x
- a name
a, b
- interval boundary points (numerical)
Description:
extrema determines the extrema of a function in one real variable on an interval [a, b] by calculating its derivative f', finding all roots x0, .., xk, .., xn of f', and checking whether there is a change of sign in the neighborhood of f'(xk), i.e. whether signum(f'(xk-xeps)) <> signum(f'(xk+xeps)).
If no interval a .. b is given and if there is no trigonometric function in f then extrema searches for extrema over the reals (=RealRange(-infinity, infinity)).
If no interval a .. b is given and if there is a trigonometric function in f then extrema searches for extrema over the default domain which is controlled by the global variable _MathDomain (default is -10 .. 10).
extrema uses the function solve to search for roots in the derivative of f. Thus the function cannot return extrema at points where f is continuous but not differentiable. Use math/END to determine those extrema, or math/ex which combines the results of math/extrema and math/END thus determining all extrema of functions even at points at which a function is not differentiable.
If solve determines complex roots in the derivative of f, then these complex values are converted to floats. After this, all imaginary parts b*I with b < _MathEps , are deleted using math/cancel , leaving only their reals parts.
If an expression contains one of the trigonometric functions sin, cos, tan, sec, csc, cot, sinh, cosh, tanh, sech, csch, coth, or BesselJ it uses math[fnull] to determine the roots. In that case you may pass options (see below) to fnull to influence accuracy. You can specify another Maple function to search for roots (see below). If there is a trigonometric function in f, however, math[fnull] is used, and this cannot be changed. fnull only returns values of type/float, so with the above listed functions in f, floats are returned by math/extrema, as well.
Because extrema uses solve in most cases, the power of extrema is limited to that of solve; note that in Release 4 solve has been improved.
Expressions containing the abs function can be given, but extrema does not return all extremas. (Use math/ex instead.)
The result is a sequence of values, sorted in ascending order, or NULL if no extrema had been found.
Options to extrema are (in any order):
'float' or 'floats' - return result as Maple floats (default: symbolic). The default
value can also be set by changing the value of the global
variable
extremaFloat
.
'all' or 'ALL' - return all extrema (default)
'min' or 'MIN' - return minima only
'max' or 'MAX' - return maxima only
Pass the following options as equations <option>=<value>:
xeps - determines neighborhood of a root p which is checked for a change
of sign, i.e. [p-xeps, p+xeps];
a positive small value, default is 1e-8. The default value can also
be set by changing the value of the global variable
extremaEps
.
Use - specify function which evaluates the roots of the derivative:
'solve' - function solve (default),
'fsolve' - function fsolve,
'fnull' - function math[fnull]
The default value can also be set by changing the value of the global
variable
extremaUse
.
Note that in math versions prior to 3.6.2, the 'use' options has been
used. This has been changed in order to comply with Maple 6.
The following options can be set if use='fnull':
alg - like option alg in fnull
approx - like option approx in fnull
eps - like option eps in fnull
numerator - like option numerator in fnull
step - like option step in fnull
User information will be displayed during the computation if infolevel[`math/extrema`] or infolevel[extrema] is assigned value 1 or 2.
This function is part of the math package, and so can be used only after performing the command with(math) or with(math, extrema).
Examples:
> with(math):
> extrema(exp(x)*x^2, x);
> extrema(exp(x)*x^2, x=-10 .. -1);
> extrema(x^2/ln(x), x, eps=1e-5, step=0.05, float);
> # x^2 does not have a maximum
> extrema(x^2, x, max);
> extrema(x^2, x, min);
> extrema(exp(x)*x^2, x, Use=fsolve);
> f := x -> 4/10*x^4-8*x^2+10*x+30;
> extrema(f(x), x);
See Also:
math/ex , math/END , math/fnull , math/inflection .
Version History:
Version 1.00 - May 26, 1997
Version 1.01 - May 31, 1997
Version 1.02 - November 25, 1997
Version 1.03 - November 08, 1997
Version 1.04 - December 15, 1997
Version 2.0 - December 30, 1997
Version 2.0.1 - April 16, 2000
Version 2.1 - July 22, 2000