## 1.6.5 Numerical Optimization

 NMinimize[f, {x, y, ... }] minimize f NMaximize[f, {x, y, ... }] maximize f NMinimize[{f, ineqs}, {x, y, ... }] minimize f subject to the constraints ineqs NMaximize[{f, ineqs}, {x, y, ... }] maximize f subject to the constraints ineqs

Finding global minima and maxima.
This gives the maximum value, and where it occurs.
 In[1]:=  NMaximize[x/(1 + Exp[x]), x]
 Out[1]=
This minimizes the function within the unit circle.
 In[2]:=  NMinimize[{Cos[x] - Exp[x y], x^2 + y^2 < 1}, {x, y}]
 Out[2]=

NMinimize and NMaximize can find the absolute minima and maxima of many functions. But in some cases it is not realistic to do this. You can search for local minima and maxima using FindMinimum and FindMaximum.

 FindMinimum[f, {x, }] search for a local minimum of f, starting at x = FindMinimum[f, {{x, }, {y, }, ... }] search for a local minimum in several variables FindMaximum[f, {x, }] search for a local maximum

Searching for local minima and maxima.
This searches for a local minimum of , starting at .
 In[3]:=  FindMinimum[x Cos[x], {x, 2}]
 Out[3]=
With a different starting point, you may reach a different local minimum.
 In[4]:=  FindMinimum[x Cos[x], {x, 10}]
 Out[4]=
This finds a local minimum of .
 In[5]:=  FindMinimum[Sin[x y], {{x, 2}, {y, 2}}]
 Out[5]=

THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.