Maximize

Maximize[f,x]

maximizes f with respect to x.

Maximize[f,{x,y,}]

maximizes f with respect to x, y, .

Maximize[{f,cons},{x,y,}]

maximizes f subject to the constraints cons.

Maximize[,xreg]

constrains x to be in the region reg.

Maximize[,,dom]

constrains variables to the domain dom, typically Reals or Integers.

Details and Options  • Maximize returns a list of the form {fmax,{x->xmax,y->ymax,}}.
• cons can contain equations, inequalities, or logical combinations of these.
• The constraints cons can be any logical combination of:
•  lhs==rhs equations lhs!=rhs inequations lhs>rhs or lhs>=rhs inequalities {x,y,…}∈reg region specification Exists[x,cond,expr] existential quantifiers
• If f and cons are linear or polynomial, Maximize will always find a global maximum.
• Maximize[{f,cons},xreg] is effectively equivalent to Maximize[{f,consxreg},x].
• For xreg, the different coordinates can be referred to using Indexed[x,i].
• Maximize will return exact results if given exact input.
• If Maximize is given an expression containing approximate numbers, it automatically calls NMaximize.
• If the maximum is achieved only infinitesimally outside the region defined by the constraints, or only asymptotically, Maximize will return the supremum and the closest specifiable point.
• If no domain is specified, all variables are assumed to be real.
• xIntegers can be used to specify that a particular variable can take on only integer values.
• If the constraints cannot be satisfied, Maximize returns {-Infinity,{x->Indeterminate,}}.
• N[Maximize[]] calls NMaximize for optimization problems that cannot be solved symbolically.
• Maximize[f,x,WorkingPrecision->n] uses n digits of precision while computing a result. »

Examples

open all close all

Basic Examples(5)

Maximize a univariate function:

 In:= Out= Maximize a multivariate function:

 In:= Out= Maximize a function subject to constraints:

 In:= Out= A maximization problem containing parameters:

 In:= Out= Maximize a function over a geometric region:

 In:= Out= Plot it:

 In:= Out= Possible Issues(1)

Introduced in 2003
(5.0)
|
Updated in 2014
(10.0)