# Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

# NMaximize

NMaximize[f,x]
maximizes f numerically with respect to x.

NMaximize[f,{x,y,}]
maximizes f numerically with respect to x, y, .

NMaximize[{f,cons},{x,y,}]
maximizes f numerically subject to the constraints cons.

NMaximize[,xreg]
constrains x to be in the region reg.

## Details and OptionsDetails and Options

• NMaximize returns a list of the form .
• cons can contain equations, inequalities or logical combinations of these.
• The constraints cons can be any logical combination of:
•  lhs==rhs equations or inequalities {x,y,…}∈reg region specification
• NMaximize[{f,cons},xreg] is effectively equivalent to NMaximize[{f,consxreg},x].
• For , the different coordinates can be referred to using Indexed[x,i].
• NMaximize 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, NMaximize can always find global maxima, over both real and integer values.
• Otherwise, NMaximize may sometimes find only a local maximum.
• If NMaximize determines that the constraints cannot be satisfied, it returns {-Infinity,{x->Indeterminate,}}.
• The following options can be given:
•  AccuracyGoal Automatic number of digits of final accuracy sought EvaluationMonitor None expression to evaluate whenever f is evaluated MaxIterations 100 maximum number of iterations to use Method Automatic method to use PrecisionGoal Automatic number of digits of final precision sought StepMonitor None expression to evaluate whenever a step is taken WorkingPrecision MachinePrecision the precision used in internal computations
• The default settings for AccuracyGoal and PrecisionGoal are .
• The settings for AccuracyGoal and PrecisionGoal specify the number of digits to seek in both the value of the position of the maximum, and the value of the function at the maximum.
• NMaximize continues until either of the goals specified by AccuracyGoal or PrecisionGoal is achieved.
• Possible settings for the Method option include , , , and .

## ExamplesExamplesopen allclose all

### Basic Examples  (3)Basic Examples  (3)

Find the global maximum of an unconstrained problem:

 In[1]:=
 Out[1]=

Extract the maximizing argument:

 In[2]:=
 Out[2]=

Find the global maximum of problems with constraints:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Maximize a function over a geometric region:

 In[1]:=
 Out[1]=

Plot it:

 In[2]:=
 Out[2]=