MaxValue

MaxValue[f,x]

gives the maximum value of f with respect to x.

MaxValue[f,{x,y,}]

gives the maximum value of f with respect to x, y, .

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

gives the maximum value of f subject to the constraints cons.

MaxValue[,xreg]

constrains x to be in the region reg.

MaxValue[,,dom]

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

Details and Options

  • MaxValue[] is effectively equivalent to First[Maximize[]].
  • MaxValue gives the supremum of values of f. It may not be attained for any values of x, y, .
  • cons can contain equations, inequalities or logical combinations of these.
  • The constraints cons can be any logical combination of:
  • lhs==rhsequations
    lhs!=rhsinequations
    lhs>rhs or lhs>=rhs inequalities
    {x,y,}regregion specification
    Exists[x,cond,expr]existential quantifiers
  • If f and cons are linear or polynomial, MaxValue will always find a global maximum.
  • MaxValue[{f,cons},xreg] is effectively equivalent to MaxValue[{f,consxreg},x].
  • For xreg, the different coordinates can be referred to using Indexed[x,i].
  • MaxValue will return exact results if given exact input.
  • If MaxValue is given an expression containing approximate numbers, it automatically calls NMaxValue.
  • 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, MaxValue returns -Infinity.
  • N[MaxValue[]] calls NMaxValue for optimization problems that cannot be solved symbolically.

Examples

open allclose all

Basic Examples  (5)

Find the maximum value of a univariate function:

In[1]:=
Click for copyable input
Out[1]=

Find the maximum value of a multivariate function:

In[1]:=
Click for copyable input
Out[1]=

Find the maximum value of a function subject to constraints:

In[1]:=
Click for copyable input
Out[1]=

Find the maximum value as a function of parameters:

In[1]:=
Click for copyable input
Out[1]=

Find the maximum value of a function over a geometric region:

In[1]:=
Click for copyable input
Out[1]=

Scope  (21)

Options  (1)

Applications  (13)

Properties & Relations  (4)

Possible Issues  (1)

See Also

ArgMax  Maximize  MinValue  NMaxValue  FindMaxValue  Max  MaximalBy

Tutorials

Introduced in 2008
(7.0)
| Updated in 2014
(10.0)