MaxValue
✖
MaxValue
Details and Options



- MaxValue is also known as supremum.
- MaxValue finds the global maximum of f subject to the constraints given.
- MaxValue is typically used to find the largest possible values given constraints. In different areas, this may be called the best strategy, best fit, best configuration and so on.
- Maximize returns a list of the form {fmax,{x->xmax,y->ymax,…}}.
- If f and cons are linear or polynomial, MaxValue will always find the global supremum.
- The constraints cons can be any logical combination of:
-
lhs==rhs equations lhs>rhs, lhs≥rhs, lhs<rhs, lhs≤rhs inequalities (LessEqual,…) lhsrhs, lhsrhs, lhsrhs, lhsrhs vector inequalities (VectorLessEqual,…) Exists[…], ForAll[…] quantified conditions {x,y,…}∈rdom region or domain specification - MaxValue[{f,cons},x∈rdom] is effectively equivalent to MaxValue[{f,cons∧x∈rdom},x].
- For x∈rdom, the different coordinates can be referred to using Indexed[x,i].
- Possible domains rdom include:
-
Reals real scalar variable Integers integer scalar variable Vectors[n,dom] vector variable in Matrices[{m,n},dom] matrix variable in ℛ vector variable restricted to the geometric region - By default, all variables are assumed to be real.
- MaxValue will return exact results if given exact input. With approximate input, it automatically calls NMaxValue.
- MaxValue will return the following forms:
-
fmax finite maximum -∞ infeasible, i.e. the constraint set is empty ∞ unbounded, i.e. the values of f can be arbitrarily large - MaxValue gives the supremum of values of f. It may not be attained for any values of x, y, ….
- N[MaxValue[…]] calls NMaxValue for optimization problems that cannot be solved symbolically.

Examples
open allclose allBasic Examples (5)Summary of the most common use cases
Find the maximum value of a univariate function:

https://wolfram.com/xid/0e7mopp2-faqf4h

Find the maximum value of a multivariate function:

https://wolfram.com/xid/0e7mopp2-b6nuhh

Find the maximum value of a function subject to constraints:

https://wolfram.com/xid/0e7mopp2-fcm1i7

Find the maximum value as a function of parameters:

https://wolfram.com/xid/0e7mopp2-65b19

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

https://wolfram.com/xid/0e7mopp2-ewyjra


https://wolfram.com/xid/0e7mopp2-dg5h30

Scope (36)Survey of the scope of standard use cases
Basic Uses (7)
Maximize over the unconstrained reals:

https://wolfram.com/xid/0e7mopp2-86qsf

Maximize subject to constraints
:

https://wolfram.com/xid/0e7mopp2-edj208

Constraints may involve arbitrary logical combinations:

https://wolfram.com/xid/0e7mopp2-dtv7r7


https://wolfram.com/xid/0e7mopp2-pjuvi


https://wolfram.com/xid/0e7mopp2-jajckq


The supremum value may not be attained:

https://wolfram.com/xid/0e7mopp2-fbfbh6


https://wolfram.com/xid/0e7mopp2-iv0iyl

Use a vector variable and a vector inequality:

https://wolfram.com/xid/0e7mopp2-lu8fwi

Univariate Problems (7)
Unconstrained univariate polynomial maximization:

https://wolfram.com/xid/0e7mopp2-dhud3y

Constrained univariate polynomial maximization:

https://wolfram.com/xid/0e7mopp2-bp80ai


https://wolfram.com/xid/0e7mopp2-or0am7

Analytic functions over bounded constraints:

https://wolfram.com/xid/0e7mopp2-cm5gkd


https://wolfram.com/xid/0e7mopp2-b1wc7x


https://wolfram.com/xid/0e7mopp2-z7foj



https://wolfram.com/xid/0e7mopp2-jpja8l


https://wolfram.com/xid/0e7mopp2-ch1ske

Combination of trigonometric functions with commensurable periods:

https://wolfram.com/xid/0e7mopp2-pbsb7r

Combination of periodic functions with incommensurable periods:

https://wolfram.com/xid/0e7mopp2-bqws15


https://wolfram.com/xid/0e7mopp2-3ogx


https://wolfram.com/xid/0e7mopp2-e9jn5u

Unconstrained problems solvable using function property information:

https://wolfram.com/xid/0e7mopp2-es0ujg


https://wolfram.com/xid/0e7mopp2-jxi0j

Multivariate Problems (9)
Multivariate linear constrained maximization:

https://wolfram.com/xid/0e7mopp2-cemla

Linear-fractional constrained maximization:

https://wolfram.com/xid/0e7mopp2-lr473t

Unconstrained polynomial maximization:

https://wolfram.com/xid/0e7mopp2-czwmlc

Constrained polynomial optimization can always be solved:

https://wolfram.com/xid/0e7mopp2-gzq2vq

The maximum value may not be attained:

https://wolfram.com/xid/0e7mopp2-byn0ry

The objective function may be unbounded:

https://wolfram.com/xid/0e7mopp2-i7gioe

There may be no points satisfying the constraints:

https://wolfram.com/xid/0e7mopp2-edzan1


Quantified polynomial constraints:

https://wolfram.com/xid/0e7mopp2-bj2pwq


https://wolfram.com/xid/0e7mopp2-dsj2qz

Bounded transcendental maximization:

https://wolfram.com/xid/0e7mopp2-pc6y7


https://wolfram.com/xid/0e7mopp2-cgyyk8


https://wolfram.com/xid/0e7mopp2-81pld6

Maximize concave objective function such that
is positive semidefinite and
:

https://wolfram.com/xid/0e7mopp2-ml87f0

Plot the function and the maximum value over the region:

https://wolfram.com/xid/0e7mopp2-cg90yz

Parametric Problems (4)
Parametric linear optimization:

https://wolfram.com/xid/0e7mopp2-ds69uj

The maximum value is a continuous function of parameters:

https://wolfram.com/xid/0e7mopp2-hbs678

Parametric quadratic optimization:

https://wolfram.com/xid/0e7mopp2-8l1oto

The maximum value is a continuous function of parameters:

https://wolfram.com/xid/0e7mopp2-cgw39

Unconstrained parametric polynomial maximization:

https://wolfram.com/xid/0e7mopp2-hvvtn9

Constrained parametric polynomial maximization:

https://wolfram.com/xid/0e7mopp2-e7xyfo

Optimization over Integers (3)

https://wolfram.com/xid/0e7mopp2-ylokw


https://wolfram.com/xid/0e7mopp2-0kjmh


https://wolfram.com/xid/0e7mopp2-lzeg4t


https://wolfram.com/xid/0e7mopp2-b4esd5

Polynomial maximization over the integers:

https://wolfram.com/xid/0e7mopp2-i09s0l

Optimization over Regions (6)
Find the maximum value of a function over a geometric region:

https://wolfram.com/xid/0e7mopp2-i9nmj9

https://wolfram.com/xid/0e7mopp2-b8yfbc


https://wolfram.com/xid/0e7mopp2-otv084

Find the maximum distance between points in two regions:

https://wolfram.com/xid/0e7mopp2-dkte2m

https://wolfram.com/xid/0e7mopp2-dfni4e

Find the maximum such that the triangle and ellipse still intersect:

https://wolfram.com/xid/0e7mopp2-ho0zb

https://wolfram.com/xid/0e7mopp2-5q1b3


https://wolfram.com/xid/0e7mopp2-dy0urb

Find the maximum for which
contains the given three points:

https://wolfram.com/xid/0e7mopp2-fxoyak

https://wolfram.com/xid/0e7mopp2-juq3he

Use to specify that
is a vector in
:

https://wolfram.com/xid/0e7mopp2-e7unye

https://wolfram.com/xid/0e7mopp2-by3xdy

Find the maximum distance between points in two regions:

https://wolfram.com/xid/0e7mopp2-kgd51l

https://wolfram.com/xid/0e7mopp2-fbbe8y

Options (1)Common values & functionality for each option
WorkingPrecision (1)
Finding the exact maximum can take a long time:

https://wolfram.com/xid/0e7mopp2-dt4zl

With WorkingPrecision->200, you get an exact maximum value, but it might be incorrect:

https://wolfram.com/xid/0e7mopp2-c5mizn

Applications (13)Sample problems that can be solved with this function
Basic Applications (4)
Find the maximal area among rectangles with a unit perimeter:

https://wolfram.com/xid/0e7mopp2-wtuty

Find the maximal area among triangles with a unit perimeter:

https://wolfram.com/xid/0e7mopp2-jayfl1

https://wolfram.com/xid/0e7mopp2-bx6cxm

Find the maximum height reached by a projectile:

https://wolfram.com/xid/0e7mopp2-il8afv


https://wolfram.com/xid/0e7mopp2-eg3gf2

Find the maximum range of a projectile:

https://wolfram.com/xid/0e7mopp2-lh3p6h


https://wolfram.com/xid/0e7mopp2-buvkpa

The infinity norm of a function f[x] is given by MaxValue[{Norm[f[x]],x∈},x] where is the domain of interest for f[x]. Find the infinity norm of over the interval {-3,3}:

https://wolfram.com/xid/0e7mopp2-dttzbo

https://wolfram.com/xid/0e7mopp2-cfooyp


https://wolfram.com/xid/0e7mopp2-b045ap

Find the infinity norm for over Rectangle[{-1,-1},{1,1}]:

https://wolfram.com/xid/0e7mopp2-dyeedv

https://wolfram.com/xid/0e7mopp2-cq9zj9


https://wolfram.com/xid/0e7mopp2-be18o1

Geometric Distances (9)
The largest distance of a point in a region ℛ to a given point p is given by MaxValue[EuclideanDistance[p,q],q∈ℛ]. Find the largest distance of a point in the unit Disk[] to the point {1,1} :

https://wolfram.com/xid/0e7mopp2-bbe5gq

https://wolfram.com/xid/0e7mopp2-ci22xk


https://wolfram.com/xid/0e7mopp2-byd4zt

Find the largest distance of a point in the standard unit simplex Simplex[2] to the point {1,3/4}:

https://wolfram.com/xid/0e7mopp2-bi7hqn

https://wolfram.com/xid/0e7mopp2-bfqxai


https://wolfram.com/xid/0e7mopp2-hfmqh

Find the largest distance of a point in the standard unit sphere Sphere[] to the point {1,1,1}:

https://wolfram.com/xid/0e7mopp2-dj6j8q

https://wolfram.com/xid/0e7mopp2-dmukk8


https://wolfram.com/xid/0e7mopp2-jz2mh

Find the largest distance of a point in the standard unit simplex Simplex[3] to the point {-1/3,1/3,1/3}:

https://wolfram.com/xid/0e7mopp2-jqaty

https://wolfram.com/xid/0e7mopp2-k97ofe


https://wolfram.com/xid/0e7mopp2-e5f7z2

The diameter of a region ℛ is the maximum distance between two points in ℛ. It can be computed through MaxValue[EuclideanDistance[p,q],{p∈ℛ,q∈ℛ}]. Find the diameter of Circle[]:

https://wolfram.com/xid/0e7mopp2-bffuv

https://wolfram.com/xid/0e7mopp2-ea32nm

Find the diameter of the standard unit simplex Simplex[2]:

https://wolfram.com/xid/0e7mopp2-cj5g0j

https://wolfram.com/xid/0e7mopp2-jo71h0

Find the diameter of the standard unit cube Cuboid[]:

https://wolfram.com/xid/0e7mopp2-hd6rj1

https://wolfram.com/xid/0e7mopp2-mdzx3x

The largest distance of points p∈ and q∈ can be found through MaxValue[EuclideanDistance[p,q],{p∈,q∈}]. Find the largest distance of points in Disk[{0,0}] and Rectangle[{3,3}]:

https://wolfram.com/xid/0e7mopp2-ft5pzx

https://wolfram.com/xid/0e7mopp2-l1hdoc

Find the largest distance of points in Line[{{0,0,0},{1,1,1}}] and Ball[{5,5,0},1]:

https://wolfram.com/xid/0e7mopp2-ogx39

https://wolfram.com/xid/0e7mopp2-h1n6ry

Properties & Relations (4)Properties of the function, and connections to other functions
Maximize gives both the value of the maximum and the maximizer point:

https://wolfram.com/xid/0e7mopp2-d8jiij

MaxValue gives an exact global maximum value of the objective function:

https://wolfram.com/xid/0e7mopp2-c3l3pu

https://wolfram.com/xid/0e7mopp2-z9fmn


https://wolfram.com/xid/0e7mopp2-dxhraz

NMaxValue attempts to find a global maximum numerically, but may find a local maximum:

https://wolfram.com/xid/0e7mopp2-kxmpp


https://wolfram.com/xid/0e7mopp2-ffnzus

FindMaxValue finds local maxima depending on the starting point:

https://wolfram.com/xid/0e7mopp2-ddl886


https://wolfram.com/xid/0e7mopp2-jjukrq

MaxValue can solve linear programming problems:

https://wolfram.com/xid/0e7mopp2-mm3mtp

LinearProgramming can be used to solve the same problem given in matrix notation:

https://wolfram.com/xid/0e7mopp2-i8n5ly

https://wolfram.com/xid/0e7mopp2-b7q2kw

Use RegionBounds to compute the bounding box:

https://wolfram.com/xid/0e7mopp2-eqkvxp


https://wolfram.com/xid/0e7mopp2-jf4d0

Use MaxValue and MinValue to compute the same bounds:

https://wolfram.com/xid/0e7mopp2-gkt1lb


https://wolfram.com/xid/0e7mopp2-ckoox0

Possible Issues (1)Common pitfalls and unexpected behavior
MaxValue requires that all functions present in the input be real-valued:

https://wolfram.com/xid/0e7mopp2-due48b

Values for which the equation is satisfied but the square roots are not real are disallowed:

https://wolfram.com/xid/0e7mopp2-mnsihk

Wolfram Research (2008), MaxValue, Wolfram Language function, https://reference.wolfram.com/language/ref/MaxValue.html (updated 2021).
Text
Wolfram Research (2008), MaxValue, Wolfram Language function, https://reference.wolfram.com/language/ref/MaxValue.html (updated 2021).
Wolfram Research (2008), MaxValue, Wolfram Language function, https://reference.wolfram.com/language/ref/MaxValue.html (updated 2021).
CMS
Wolfram Language. 2008. "MaxValue." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/MaxValue.html.
Wolfram Language. 2008. "MaxValue." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/MaxValue.html.
APA
Wolfram Language. (2008). MaxValue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MaxValue.html
Wolfram Language. (2008). MaxValue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MaxValue.html
BibTeX
@misc{reference.wolfram_2025_maxvalue, author="Wolfram Research", title="{MaxValue}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/MaxValue.html}", note=[Accessed: 25-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_maxvalue, organization={Wolfram Research}, title={MaxValue}, year={2021}, url={https://reference.wolfram.com/language/ref/MaxValue.html}, note=[Accessed: 25-March-2025
]}