minimize
compute the minimum symbolically
maximize
compute the maximum symbolically
Calling Sequence
Parameters
Description
Examples
minimize(expr, opt1, opt2, ..., optn)
maximize(expr, opt1, opt2, ..., optn)
expr
-
algebraic expression
opt1, opt2, ..., optn
options -- see below
The minimize(expr, opt1, opt2, ..., optn) function returns the infimum of expr if possible. If minimize cannot find the infimum, it returns an unevaluated function call.
If the option location or location = true is given then the output is an expression sequence with the first argument being the minimum and the second a set of lists, where the first argument of each list is a set of substitutions that describe a point at or in a neighborhood of where the infimum is either achieved or approached. If minimize returns unevaluated, the second argument is the empty set {} and the location flag is removed.
If an option is a name equated to a range then minimize finds the infimum of that function over the given range. If the range is the entire real line -infinity..infinity then range can be omitted.
The variables over which the expression are to be minimized can be given implicitly as options or explicitly as a list containing all such variable ranges. This second format is necessary if one is minimizing with respect to a variable that appears as an option to minimize.
If no names over which to minimize are given then minimize finds the infimum over all indeterminates of type name.
The function maximize is defined to compute the negative of the result of minimize applied to the negated expr.
The solvers in the Optimization package can also be used for minimization and maximization of expressions. These solvers allow constraints to be specified and are generally more efficient than the minimize and maximize commands. However, they perform all computation using floating-point values and return only local solutions to non-convex optimization problems.
minimize⁡cos⁡x,x=1..3
cos⁡3
maximize⁡cos⁡x,x=1..3
cos⁡1
minimize⁡exp⁡tan⁡x,x=0..10
0
minimize⁡x2−3⁢x+y2+3⁢y+3
−32
minimize⁡x2−3⁢x+y2+3⁢y+3,location
−32,x=32,y=−32,−32
minimize⁡x2−3⁢x+y2+3⁢y+3,x=2..4,y=−4..−2,location
−1,x=2,y=−2,−1
maximize⁡x2−3⁢x+y2+3⁢y+3,x=2..4,y=−4..−2,location
11,x=4,y=−4,11
minimize⁡abs⁡exp⁡−x2−12,x=−4..4,location
0,x=ln⁡2,0,x=−ln⁡2,0
maximize⁡abs⁡exp⁡−x2−12,x=−4..4
12
minimize⁡x4−x2,x=−3..3,location=true
−14,x=−22,−14,x=22,−14
minimize⁡x2+cos⁡x,x=0..3
1
'location' is an option and therefore all variables to be minimized over must be placed in a list
minimize⁡sin⁡location⁢y,location=1..1,y=−1..1,location
−sin⁡1,y=−1,−sin⁡1
Changing the setting for Normalizer environment variable can in some cases simplify the solution.
f≔x2+y22+1x2+y2+x2−2⁢x+1+y22+1x2−2⁢x+1+y2:
alias⁡r=RootOf⁡2⁢_Z2−2⁢RootOf⁡2⁢_Z3−1,index=1−2⁢_Z+1,1.237360513
r
minimize⁡f
8⁢r6−24⁢r5+36⁢r4−32⁢r3+18⁢r2−6⁢r+92⁢2⁢r2−2⁢r+1
Normalizer≔simplify:
3⁢213
Note that assumptions may be placed on the location of the minima, especially if the function is periodic and contains equally valued minima at multiple locations.
minimize⁡sin⁡x+cos⁡x,x=0..20,location
−2,x=54+2⁢_Z16⁢π,−2
about⁡indets⁡2,suffixed⁡_Z,integer
{_Z16}: is used in the following assumed objects [_Z16] assumed AndProp(integer,RealRange(0,2))
The solutions can be made explicit by setting _EnvExplicit to true.
_EnvExplicit≔true:
−2,x=5⁢π4,−2,x=13⁢π4,−2,x=21⁢π4,−2
See Also
envvar
extrema
infnorm
Optimization
simplex
Download Help Document