---
title: "FindMaximum"
language: "en"
type: "Symbol"
summary: "FindMaximum[f, x] searches for a local maximum in f, starting from an automatically selected point. FindMaximum[f, {x, x0}] searches for a local maximum in f, starting from the point x = x0. FindMaximum[f, {{x, x0}, {y, y0}, ...}] searches for a local maximum in a function of several variables. FindMaximum[{f, cons}, {{x, x0}, {y, y0}, ...}] searches for a local maximum subject to the constraints cons. FindMaximum[{f, cons}, {x, y, ...}] starts from a point within the region defined by the constraints."
keywords: 
- conjugate gradient
- constrained local optimization
- constrained optimization
- convex programming
- Gauss-Newton algorithm
- GNA
- gradient
- gradient descent
- interior point algorithm
- Levenberg-Marquardt method
- linear fractional programming
- linear programming
- local maximization
- local optimization
- Newton's method
- numerical maximum
- quadratic programming
- quasi-Newton
- steepest-descent
- argmax
- maxpos
- ConjugateGradient
- LevenbergMarquardt
- Newton
- QuasiNewton
canonical_url: "https://reference.wolfram.com/language/ref/FindMaximum.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Optimization"
    link: "https://reference.wolfram.com/language/guide/Optimization.en.md"
  - 
    title: "Convex Optimization"
    link: "https://reference.wolfram.com/language/guide/ConvexOptimization.en.md"
  - 
    title: "Symbolic Vectors, Matrices and Arrays"
    link: "https://reference.wolfram.com/language/guide/SymbolicArrays.en.md"
related_functions: 
  - 
    title: "FindMinimum"
    link: "https://reference.wolfram.com/language/ref/FindMinimum.en.md"
  - 
    title: "NMaximize"
    link: "https://reference.wolfram.com/language/ref/NMaximize.en.md"
  - 
    title: "Maximize"
    link: "https://reference.wolfram.com/language/ref/Maximize.en.md"
  - 
    title: "FindArgMax"
    link: "https://reference.wolfram.com/language/ref/FindArgMax.en.md"
  - 
    title: "FindMaxValue"
    link: "https://reference.wolfram.com/language/ref/FindMaxValue.en.md"
  - 
    title: "FindFit"
    link: "https://reference.wolfram.com/language/ref/FindFit.en.md"
  - 
    title: "LinearOptimization"
    link: "https://reference.wolfram.com/language/ref/LinearOptimization.en.md"
  - 
    title: "ConvexOptimization"
    link: "https://reference.wolfram.com/language/ref/ConvexOptimization.en.md"
  - 
    title: "GeometricOptimization"
    link: "https://reference.wolfram.com/language/ref/GeometricOptimization.en.md"
  - 
    title: "D"
    link: "https://reference.wolfram.com/language/ref/D.en.md"
  - 
    title: "FindRoot"
    link: "https://reference.wolfram.com/language/ref/FindRoot.en.md"
  - 
    title: "BayesianMaximization"
    link: "https://reference.wolfram.com/language/ref/BayesianMaximization.en.md"
related_tutorials: 
  - 
    title: "Constrained Optimization"
    link: "https://reference.wolfram.com/language/tutorial/ConstrainedOptimizationOverview.en.md"
  - 
    title: "Unconstrained Optimization"
    link: "https://reference.wolfram.com/language/tutorial/UnconstrainedOptimizationOverview.en.md"
  - 
    title: "Numerical Optimization"
    link: "https://reference.wolfram.com/language/tutorial/NumericalOperationsOnFunctions.en.md#24524"
  - 
    title: "Symbolic Evaluation"
    link: "https://reference.wolfram.com/language/tutorial/UnconstrainedOptimizationSettingUpOptimizationProblems.en.md#147397427"
---
# FindMaximum

FindMaximum[f, x] searches for a local maximum in f, starting from an automatically selected point.

FindMaximum[f, {x, x0}] searches for a local maximum in f, starting from the point x = x0. 

FindMaximum[f, {{x, x0}, {y, y0}, …}] searches for a local maximum in a function of several variables. 

FindMaximum[{f, cons}, {{x, x0}, {y, y0}, …}] searches for a local maximum subject to the constraints cons.

FindMaximum[{f, cons}, {x, y, …}] starts from a point within the region defined by the constraints.

## Details and Options

* ``FindMaximum`` returns a list of the form ``{fmax, {x -> xmax}}``, where ``fmax`` is the maximum value of ``f`` found, and ``xmax`` is the value of ``x`` for which it is found.

* If the starting point for a variable is given as a list, the values of the variable are taken to be lists with the same dimensions.

* The constraints ``cons`` can contain equations, inequalities or logical combinations of these.

* The constraints ``cons`` can be any logical combination of:

|                          |                      |
| :----------------------- | :------------------- |
| lhs == rhs               | equations            |
| lhs > rhs or lhs >= rhs  | inequalities         |
| {x, y, …}∈reg            | region specification |

* ``FindMaximum`` first localizes the values of all variables, then evaluates ``f`` with the variables being symbolic, and then repeatedly evaluates the result numerically.

* ``FindMaximum`` has attribute ``HoldAll``, and effectively uses ``Block`` to localize variables.

* ``FindMaximum[f, {x, x0, x1}]`` searches for a local maximum in ``f`` using ``x0`` and ``x1`` as the first two values of ``x``, avoiding the use of derivatives.

* ``FindMaximum[f, {x, x0, xmin, xmax}]`` searches for a local maximum, stopping the search if ``x`` ever gets outside the range ``xmin`` to ``xmax``.

* Except when ``f`` and ``cons`` are both linear, the results found by ``FindMaximum`` may correspond only to local, but not global, maxima.

* By default, all variables are assumed to be real.

* For linear ``f`` and ``cons``, ``x∈Integers`` can be used to specify that a variable can take on only integer values.

* The following options can be given:

|                    |                  |                                                      |
| :----------------- | :--------------- | :--------------------------------------------------- |
| AccuracyGoal       | Automatic        | the accuracy sought                                  |
| EvaluationMonitor  | None             | expression to evaluate whenever f is evaluated       |
| Gradient           | Automatic        | the list of gradient functions {D[f, x], D[f, y], …} |
| MaxIterations      | Automatic        | maximum number of iterations to use                  |
| Method             | Automatic        | method to use                                        |
| PrecisionGoal      | Automatic        | the precision sought                                 |
| StepMonitor        | None             | expression to evaluate whenever a step is taken      |
| WorkingPrecision   | MachinePrecision | the precision used in internal computations          |

* 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.

* ``FindMaximum`` continues until either of the goals specified by ``AccuracyGoal`` or ``PrecisionGoal`` is achieved.

* Possible settings for ``Method`` include ``"ConjugateGradient"``, ``"PrincipalAxis"``, ``"LevenbergMarquardt"``, ``"Newton"``, and ``"QuasiNewton"``, with the default being ``Automatic``.

---

## Examples (31)

### Basic Examples (4)

Find a local maximum, starting the search at $x=2$ :

```wl
In[1]:= FindMaximum[x Cos[x], {x, 2}]

Out[1]= {0.561096, {x -> 0.860334}}

In[2]:= Plot[x Cos[x], {x, 0, 14}]

Out[2]= [image]
```

Extract the value of ``x`` at the local maximum:

```wl
In[3]:= x /. Last[FindMaximum[x Cos[x], {x, 2}]]

Out[3]= 0.860334
```

---

Find a local maximum, starting at $x=7$, subject to constraints $1\leq  x \leq  15$ :

```wl
In[1]:= FindMaximum[{x Cos[x], 1 ≤ x ≤ 15}, {x, 7}]

Out[1]= {6.361, {x -> 6.4373}}
```

---

Find the maximum of a linear function, subject to linear and integer constraints:

```wl
In[1]:= FindMaximum[{-x - y, x + 2y ≥ 3 && x ≥ 0 && y ≥ 0 && y∈Integers}, {x, y}]

Out[1]= {-2., {x -> 1., y -> 1}}
```

---

Find a maximum of a function over a geometric region:

```wl
In[1]:= FindMaximum[{x + y, {x, y}∈Disk[]}, {x, y}]

Out[1]= {1.41422, {x -> 0.707108, y -> 0.707108}}
```

Plot it:

```wl
In[2]:= Show[ContourPlot[x + y, {x, y}∈Disk[]], Graphics[{Red, PointSize[Large], Point[{x, y} /. Last[%]]}]]

Out[2]= [image]
```

### Scope (12)

With different starting points, get different local maxima:

```wl
In[1]:= FindMaximum[x Cos[x], {x, 5}]

Out[1]= {6.361, {x -> 6.4373}}

In[2]:= FindMaximum[x Cos[x], {x, 10}]

Out[2]= {12.6059, {x -> 12.6453}}
```

---

Local maximum of a two-variable function starting from $x=2$, $y=2$ :

```wl
In[1]:= FindMaximum[Sin[x]Sin[2y], {{x, 2}, {y, 2}}]

Out[1]= {1., {x -> 1.5708, y -> 0.785398}}
```

---

Local maximum constrained within a disk:

```wl
In[1]:= FindMaximum[{Sin[x]Sin[2y], x ^ 2 + y ^ 2 < 3}, {{x, 2}, {y, 2}}]

Out[1]= {0.999656, {x -> 1.54538, y -> 0.782181}}
```

---

Starting point does not have to be provided:

```wl
In[1]:= FindMaximum[{Sin[x]Sin[2y], x ^ 2 + y ^ 2 < 3}, {x, y}]

Out[1]= {0.999656, {x -> 1.54538, y -> 0.782181}}
```

---

For linear objective and constraints, integer constraints can be imposed:

```wl
In[1]:= FindMaximum[{-x - y, 3x + 2y ≥ 7 && x ≥ 0 && y ≥ 0}, {x, y}]

Out[1]= {-2.33333, {x -> 2.33333, y -> 0.}}

In[2]:= FindMaximum[{-x - y, 3x + 2y ≥ 7 && x ≥ 0 && y ≥ 0 && x∈Integers}, {x, y}]

Out[2]= {-2.5, {x -> 2, y -> 0.5}}
```

---

``Or`` constraints can be specified:

```wl
In[1]:= FindMaximum[{x + y, x ^ 2 + y ^ 2 ≤ 1 || (x + 2) ^ 2 + (y + 2) ^ 2 ≤ 1}, {x, y}]

Out[1]= {1.41421, {x -> 0.707106, y -> 0.707106}}
```

---

Find a maximum over a region:

```wl
In[1]:= ℛ = Cylinder[{{-1, 0, 1}, {1, 0, -1}}, 1];

In[2]:= FindMaximum[{z, {x, y, z}∈ℛ}, {x, y, z}]

Out[2]= {1.70711, {x -> -0.292893, y -> -2.7031365384650446`*^-8, z -> 1.70711}}
```

Plot it:

```wl
In[3]:= Graphics3D[{{Opacity[0.5], Green, ℛ}, {Red, PointSize[Large], Point[{x, y, z} /. Last[%]]}}]

Out[3]= [image]
```

---

Find the maximum distance between points in two regions:

```wl
In[1]:=
Subscript[ℛ, 1] = Disk[];
Subscript[ℛ, 2] = Line[{{-(1/2), -(1/2)}, {-(1/2), (1/2)}, {(1/2), (1/2)}, {(1/2), -(1/2)}, {-(1/2), -(1/2)}}];

In[2]:= FindMaximum[{(x - u)^2 + (y - v)^2, {{x, y}∈Subscript[ℛ, 1], {u, v}∈Subscript[ℛ, 2]}}, {x, y, u, v}]

Out[2]= {2.91421, {x -> -0.707107, y -> 0.707107, u -> 0.5, v -> -0.5}}
```

Plot it:

```wl
In[3]:= Graphics[{{LightBlue, Subscript[ℛ, 1]}, {Green, Subscript[ℛ, 2]}, {Red, Point[{{x, y}, {u, v}} /. Last[%]]}}]

Out[3]= [image]
```

---

Find the maximum $r$ such that the rectangle and ellipse still intersect:

```wl
In[1]:=
Subscript[ℛ, 1] = Rectangle[];
Subscript[ℛ, 2] = Circle[{(1/3), (1/3)}, {2 r, r}];

In[2]:= FindMaximum[{r, {x, y}∈Subscript[ℛ, 1] && {x, y}∈Subscript[ℛ, 2]}, {r, x, y}]

Out[2]= {0.745356, {r -> 0.745356, x -> 1., y -> 1.}}
```

Plot it:

```wl
In[3]:= Graphics[{{LightBlue, Subscript[ℛ, 1]}, {Green, Subscript[ℛ, 2]}, {Red, Point[{x, y}]}} /. Last[%]]

Out[3]= [image]
```

---

Find the maximum $r$ for which $\mathcal{R}_3$ contains the given three points:

```wl
In[1]:= Subscript[ℛ, 3] = Disk[{a, b}, {r, 2 - r}];

In[2]:= FindMaximum[{r, ({0, 0} | {1, 0} | {0, 1})∈Subscript[ℛ, 3]}, {a, b, r}]

Out[2]= {1.46821, {a -> 0.498111, b -> 0.499752, r -> 1.46821}}
```

Plot it:

```wl
In[3]:= Graphics[{{LightBlue, Subscript[ℛ, 3]} /. Last[%], {Red, Point[{{0, 0}, {1, 0}, {0, 1}}]}}]

Out[3]= [image]
```

---

Use $x\in \mathcal{R}$ to specify that $x$ is a vector in $\mathbb{R}^3$ :

```wl
In[1]:= ℛ = Sphere[];

In[2]:= FindMaximum[{x.{1, 2, 3}, x∈ℛ}, x]

Out[2]= {3.74166, {x -> {0.267261, 0.534522, 0.801784}}}
```

---

Find the maximum distance between points in two regions:

```wl
In[1]:=
Subscript[ℛ, 1] = Triangle[{{0, 0}, {1, 0}, {0, 1}}];
Subscript[ℛ, 2] = Disk[{2, 2}, 1];

In[2]:= FindMaximum[{EuclideanDistance[x, y], {x∈Subscript[ℛ, 1], y∈Subscript[ℛ, 2]}}, {x, y}]

Out[2]= {3.82843, {x -> {2.69105051139632`*^-7, 2.6910078849565615`*^-7}, y -> {2.70711, 2.70711}}}
```

Plot it:

```wl
In[3]:= Graphics[{{LightBlue, Subscript[ℛ, 1], Subscript[ℛ, 2]}, {Red, Point[{x, y}]}} /. Last[%]]

Out[3]= [image]
```

### Options (7)

#### AccuracyGoal & PrecisionGoal (2)

This enforces convergence criteria $\left\|x_k-x^*\right\| \leq  \max \left(10^{-9},10^{-8}\left\|x_k\right\|\right)$ and $\text{$\triangledown $f}\left(x_k\right)\leq 10^{-9}$ :

```wl
In[1]:= FindMaximum[Sin[x / 2], {x, 1}, AccuracyGoal -> 9, PrecisionGoal -> 8]

Out[1]= {1., {x -> 3.14159}}
```

---

This enforces convergence criteria $\left\|x_k-x^*\right\| \leq  \max \left(10^{-20},10^{-18}\left\|x_k\right\|\right)$ and $\text{$\triangledown $f}\left(x_k\right)\leq 10^{-20}$ :

```wl
In[1]:= FindMaximum[Sin[x / 2], {x, 1}, AccuracyGoal -> 20, PrecisionGoal -> 18]
```

FindMaximum::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient increase in the function.  You may need more than MachinePrecision digits of working precision to meet these tolerances.

```wl
Out[1]= {1., {x -> 3.14159}}
```

Setting a high ``WorkingPrecision`` makes the process convergent:

```wl
In[2]:= FindMaximum[Sin[x / 2], {x, 1}, AccuracyGoal -> 20, PrecisionGoal -> 18, WorkingPrecision -> 40]

Out[2]= {1.00000000000000000000000000000000000000, {x -> 3.141592653589793238462641984960942392598}}
```

#### EvaluationMonitor (1)

Plot convergence to the local maximum:

```wl
In[1]:= ListPlot[Last[Reap[FindMaximum[x Cos[x], {x, 5}, EvaluationMonitor :> Sow[x]]]]]

Out[1]= [image]
```

#### Gradient (1)

Use a given gradient; the Hessian is computed automatically:

```wl
In[1]:= FindMaximum[Sin[x]Sin[2 y], {x, y}, Gradient -> {Cos[x] Sin[2 y], 2 Cos[2 y] Sin[x]}, Method -> "Newton"]

Out[1]= {1., {x -> 1.5708, y -> 0.785398}}
```

Supply both gradient and Hessian:

```wl
In[2]:= FindMaximum[Sin[x]Sin[2y], {x, y}, Gradient -> {Cos[x] Sin[2 y], 2 Cos[2 y] Sin[x]}, Method -> {"Newton", Hessian -> {{-Sin[x] Sin[2 y], 2 Cos[x] Cos[2 y]}, {2 Cos[x] Cos[2 y], -4 Sin[x] Sin[2 y]}}}]

Out[2]= {1., {x -> 1.5708, y -> 0.785398}}
```

#### Method (1)

In this case the default derivative-based methods have difficulties:

```wl
In[1]:= FindMaximum[-Abs[x + 1] - Abs[x + 1.01] - Abs[y + 1], {x, y}]

Out[1]= {-0.01, {x -> -1.00683, y -> -1.}}

In[2]:= FindMaximum[-Abs[x + 1] - Abs[x + 1.01] - Abs[y + 1], {x, y}, Method -> "ConjugateGradient"]
```

FindMaximum::lstol: The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient increase in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances.

```wl
Out[2]= {-0.01, {x -> -1.00435, y -> -1.}}
```

Direct search methods which do not require derivatives can be helpful in these cases:

```wl
In[3]:= FindMaximum[-Abs[x + 1] - Abs[x + 1.01] - Abs[y + 1], {x, y}, Method -> "PrincipalAxis"]

Out[3]= {-0.01, {x -> -1.00671, y -> -1.}}
```

``NMaximize`` also uses a range of direct search methods:

```wl
In[4]:= NMaximize[{-Abs[x + 1] - Abs[x + 1.01] - Abs[y + 1]}, {x, y}]

Out[4]= {-0.01, {x -> -1.00735, y -> -1.}}
```

#### StepMonitor (1)

Steps taken by ``FindMaximum`` in finding the maximum of a function:

```wl
In[1]:=
pts = Reap[FindMaximum[-(1 - x) ^ 2 - 100(-x ^ 2 - y) ^ 2 - 1, {{x, -1.2}, {y, 1}}, StepMonitor :> Sow[{x, y}]]][[2, 1]];
pts  = Join[{{-1.2, 1}}, pts];

In[2]:= ContourPlot[-(1 - x) ^ 2 - 100(-x ^ 2 - y) ^ 2 - 1//Minus//Log, {x, -1.3, 1.5}, {y, -1.5, 1.4}, Epilog -> {Red, Line[pts], Point[pts]}]

Out[2]= [image]
```

#### WorkingPrecision (1)

Set the working precision to $20$; by default ``AccuracyGoal`` and ``PrecisionGoal`` are set to $\frac{20}{2}$ :

```wl
In[1]:= FindMaximum[Cos[x ^ 2 - 3 y] + Sin[x ^ 2 + y ^ 2], {x, y}, Method -> "Newton", WorkingPrecision -> 20]

Out[1]= {2.0000000000000000000, {x -> 1.1679285972222502906, y -> 0.45468573606984368463}}
```

### Properties & Relations (2)

``FindMaximum`` tries to find a local maximum; ``NMaximize ``attempts to find a global maximum:

```wl
In[1]:= FindMaximum[{$$100\left/\left((x-1)^2+(y-1)^2+1\right)\right.+200\left/\left((x+1)^2+(y+2)^2+1\right)\right.$$, $$x^2+y^2>3$$ }, {{x, 2}, y}]

Out[1]= {103.063, {x -> 1.23037, y -> 1.21909}}

In[2]:= NMaximize[{$$100\left/\left((x-1)^2+(y-1)^2+1\right)\right.+200\left/\left((x+1)^2+(y+2)^2+1\right)\right.$$, $$x^2+y^2>3$$ }, {x, y}]

Out[2]= {207.16, {x -> -0.994929, y -> -1.99248}}

In[3]:= ContourPlot[100 / (((x - 1)) ^ 2 + ((y - 1)) ^ 2 + 1) + 200 / (((x + 1)) ^ 2 + ((y + 2)) ^ 2 + 1), {x, -3, 2}, {y, -3, 2}, RegionFunction -> (#1 ^ 2 + #2 ^ 2 > 3&), Contours -> 10, Epilog -> ({Red, PointSize[.02], Text["global maximum", {-.995, -2.092}], Point[{-.995, -1.992}], Text["local maximum", {0.5304, 1.2191}], Point[{1.2304, 1.2191}]}), ContourLabels -> True]

Out[3]= [image]
```

``Maximize`` finds a global maximum and can work in infinite precision:

```wl
In[4]:= Maximize[{$$100\left/\left((x-1)^2+(y-1)^2+1\right)\right.+200\left/\left((x+1)^2+(y+2)^2+1\right)\right.$$, $$x^2+y^2>3$$ }, {x, y}]

Out[4]=
{-Root[9450000000000 - 1185300000000*#1 + 39312000000*#1^2 + 1872000000*#1^3 + 18099900*#1^4 + 
   48841*#1^5 & , 1, 0], {x -> Root[{9450000000000 - 1185300000000*#1 + 39312000000*#1^2 + 1872000000*#1^3 + 18099900*#1^4 + 
    48841*#1^5 & , -410125 ... 0*#1^3)*#2^8 - 
    (48942129600*#1^4)*#2^8 & , 1200 + 18*#1 - 200*#2 - (6*#1)*#2 + 300*#2^2 + (5*#1)*#2^2 + 
    #1*#2^4 - ((12*#1)*#2)*#3 + ((2*#1)*#2^2)*#3 + 300*#3^2 + #1*#3^2 + ((2*#1)*#2^2)*#3^2 + 
    (2*#1)*#3^3 + #1*#3^4 & }, {1, 2, 2}]}}

In[5]:= N[%]

Out[5]= {207.16, {x -> -0.994861, y -> -1.99229}}
```

---

``FindMaximum`` gives both the value of the maximum and the maximizer point:

```wl
In[1]:= FindMaximum[{x - 2y, x ^ 2 + y ^ 2 ≤ 1}, {x, y}]

Out[1]= {2.23607, {x -> 0.447214, y -> -0.894427}}
```

``FindArgMax`` gives the location of the maximum:

```wl
In[2]:= FindArgMax[{x - 2y, x ^ 2 + y ^ 2 ≤ 1}, {x, y}]

Out[2]= {0.447214, -0.894427}
```

``FindMaxValue`` gives the value at the maximum:

```wl
In[3]:= FindMaxValue[{x - 2y, x ^ 2 + y ^ 2 ≤ 1}, {x, y}]

Out[3]= 2.23607
```

### Possible Issues (6)

With machine-precision arithmetic, even functions with smooth maxima may seem bumpy:

```wl
In[1]:= x /. Last[FindMaximum[x Cos[x], {x, -1}]]
```

FindMaximum::lstol: The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient increase in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances.

```wl
Out[1]= -3.42562

In[2]:= Plot[x Cos[x], {x, % - 1.*^-7, % + 1.*^-7}, PlotRange -> All]

Out[2]= [image]
```

Going beyond machine precision often avoids such problems:

```wl
In[3]:= FindMinimum[x Cos[x], {x, -1}, WorkingPrecision -> 30]

Out[3]= {-0.561096338191045067540403753161, {x -> -0.860333589019379682419496130270}}
```

---

If the constraint region is empty, the algorithm will not converge:

```wl
In[1]:= FindMaximum[{x + y, x ^ 2 + y ^ 2 ≥ 2 && x ^ 2 + y ^ 2 ≤ 1}, {x, y}]
```

FindMaximum::infeas: Possible infeasibility detected. Returning the best solution found. Setting a different initial point or Method -> InteriorPoint may lead to a better solution.

```wl
Out[1]= {1.7239, {x -> 0.861951, y -> 0.861951}}
```

---

If the maximum value is not finite, the algorithm will not converge:

```wl
In[1]:= FindMaximum[Tan[x], {x, 2}]
```

FindMaximum::sdprec: Line search unable to find a sufficient increase in the function value with MachinePrecision digit precision.

```wl
Out[1]= {4.801878020208886*^14, {x -> 7.85398}}

In[2]:= FindMaximum[{x ^ 2 + y ^ 2, x ^ 2 + y ^ 2 > 10}, {x, y}]
```

FindMaximum::cvmit: Failed to converge to the requested accuracy or precision within 500 iterations.

```wl
Out[2]= {3.5836016962142324*^9, {x -> 42329.7, y -> 42329.7}}
```

---

Integer linear programming algorithm is only available for machine-number problems:

```wl
In[1]:= FindMaximum[{-x - y, x + 2y ≥ 3 && x > 1 && y > 1 && x∈Integers}, {x, y}, WorkingPrecision -> 20]
```

FindMaximum::lpip: Warning: integer linear programming will use a machine-precision approximation of the inputs.

```wl
Out[1]= {-2., {x -> 1, y -> 1.}}
```

---

Sometimes providing a suitable starting point can help the algorithm to converge:

```wl
In[1]:= FindMaximum[{-Cos[x] + Exp[(x - 0.5) y], x ^ 2 + y ^ 2 < 1}, {x, y}]

Out[1]= {0.573452, {x -> 0.927095, y -> 0.374826}}

In[2]:= FindMaximum[{-Cos[x] + Exp[(x - 0.5) y], x ^ 2 + y ^ 2 < 1}, {{x, -1}, {y, -1}}]

Out[2]= {1.60046, {x -> -0.657219, y -> -0.7537}}
```

---

It can be time-consuming to compute functions symbolically:

```wl
In[1]:= f[x_] := Nest[Sin[# + Sin[2#]]&, x, 15]

In[2]:= FindMaximum[f[x], {x, 0}]//Timing
```

FindMaximum::lstol: The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient increase in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances.

```wl
Out[2]= {2.92637, {0.947747, {x -> 0.00022845}}}
```

Restricting the function definition prevents symbolic evaluation:

```wl
In[3]:= g[x_ ? NumericQ] := Nest[Sin[# + Sin[2#]]&, x, 15]

In[4]:= FindMaximum[g[x], {x, 0}]//Timing
```

FindMaximum::lstol: The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient increase in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances.

```wl
Out[4]= {0.003073, {0.947747, {x -> 0.000228451}}}
```

## See Also

* [`FindMinimum`](https://reference.wolfram.com/language/ref/FindMinimum.en.md)
* [`NMaximize`](https://reference.wolfram.com/language/ref/NMaximize.en.md)
* [`Maximize`](https://reference.wolfram.com/language/ref/Maximize.en.md)
* [`FindArgMax`](https://reference.wolfram.com/language/ref/FindArgMax.en.md)
* [`FindMaxValue`](https://reference.wolfram.com/language/ref/FindMaxValue.en.md)
* [`FindFit`](https://reference.wolfram.com/language/ref/FindFit.en.md)
* [`LinearOptimization`](https://reference.wolfram.com/language/ref/LinearOptimization.en.md)
* [`ConvexOptimization`](https://reference.wolfram.com/language/ref/ConvexOptimization.en.md)
* [`GeometricOptimization`](https://reference.wolfram.com/language/ref/GeometricOptimization.en.md)
* [`D`](https://reference.wolfram.com/language/ref/D.en.md)
* [`FindRoot`](https://reference.wolfram.com/language/ref/FindRoot.en.md)
* [`BayesianMaximization`](https://reference.wolfram.com/language/ref/BayesianMaximization.en.md)

## Tech Notes

* [Constrained Optimization](https://reference.wolfram.com/language/tutorial/ConstrainedOptimizationOverview.en.md)
* [Unconstrained Optimization](https://reference.wolfram.com/language/tutorial/UnconstrainedOptimizationOverview.en.md)
* [Numerical Optimization](https://reference.wolfram.com/language/tutorial/NumericalOperationsOnFunctions.en.md#24524)
* [Symbolic Evaluation](https://reference.wolfram.com/language/tutorial/UnconstrainedOptimizationSettingUpOptimizationProblems.en.md#147397427)

## Related Guides

* [`Optimization`](https://reference.wolfram.com/language/guide/Optimization.en.md)
* [Convex Optimization](https://reference.wolfram.com/language/guide/ConvexOptimization.en.md)
* [Symbolic Vectors, Matrices and Arrays](https://reference.wolfram.com/language/guide/SymbolicArrays.en.md)

## History

* Introduced in 2003 (5.0) \| [Updated in 2007 (6.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn60.en.md) ▪ [2014 (10.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn100.en.md)