NMaxValue

NMaxValue[f, x]
gives the maximum value of f with respect to x.

NMaxValue[f, {x, y, ...}]
gives the maximum value of f with respect to x, y, ....

NMaxValue[{f, cons}, {x, y, ...}]
gives the maximum value of f subject to the constraints cons.

Details and OptionsDetails and Options

  • NMaxValue[...] is effectively equivalent to First[NMaximize[...]].
  • cons can contain equations, inequalities or logical combinations of these.
  • NMaxValue always attempts to find a global maximum of f subject to the constraints given.
  • By default, all variables are assumed to be real.
  • xIntegers can be used to specify that a variable can take on only integer values.
  • If f and cons are linear, NMaxValue can always find global maxima, over both real and integer values.
  • Otherwise, NMaxValue may sometimes find only a local maximum.
  • If NMaxValue determines that the constraints cannot be satisfied, it returns -Infinity.
  • NMaxValue takes the same options as NMaximize.

ExamplesExamplesopen allclose all

Basic Examples (3)Basic Examples (3)

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]=
New in 7
New to Mathematica? Find your learning path »
Have a question? Ask support »