ArgMax

ArgMax[f,x]

gives a position xmax at which f is maximized.

ArgMax[f,{x,y,}]

gives a position {xmax,ymax,} at which f is maximized.

ArgMax[{f,cons},{x,y,}]

gives a position at which f is maximized subject to the constraints cons.

ArgMax[,xrdom]

constrains x to be in the region or domain rdom.

ArgMax[,,dom]

constrains variables to the domain dom, typically Reals or Integers.

Details and Options

  • ArgMax finds the global maximum of f subject to the constraints given.
  • ArgMax 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.
  • If f and cons are linear or polynomial, ArgMax will always find a global maximum.
  • The constraints cons can be any logical combination of:
  • lhs==rhsequations
    lhs>rhs, lhsrhs, lhs<rhs, lhsrhsinequalities (LessEqual,)
    lhsrhs, lhsrhs, lhsrhs, lhsrhsvector inequalities (VectorLessEqual,)
    Exists[], ForAll[]quantified conditions
    {x,y,}rdomregion or domain specification
  • ArgMax[{f,cons},xrdom] is effectively equivalent to ArgMax[{f,consxrdom},x].
  • For xrdom, the different coordinates can be referred to using Indexed[x,i].
  • Possible domains rdom include:
  • Realsreal scalar variable
    Integersinteger 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.
  • ArgMax will return exact results if given exact input. With approximate input, it automatically calls NArgMax.
  • If the maximum is achieved only infinitesimally outside the region defined by the constraints, or only asymptotically, ArgMax will return the closest specifiable point.
  • Even if the same maximum is achieved at several points, only one is returned.
  • If the constraints cannot be satisfied, ArgMax returns {Indeterminate,Indeterminate,}.
  • N[ArgMax[]] calls NArgMax for optimization problems that cannot be solved symbolically.

Examples

open allclose all

Basic Examples  (5)

Find a maximizer point for a univariate function:

Find a maximizer point for a multivariate function:

Find a maximizer point for a function subject to constraints:

Find a maximizer point as a function of parameters:

Find a maximizer point for a function over a geometric region:

Plot it:

Scope  (36)

Basic Uses  (7)

Maximize over the unconstrained reals:

If the single variable is not given in a list, the result is a value at which the maximum is attained:

Maximize subject to constraints :

Constraints may involve arbitrary logical combinations:

An unbounded problem:

An infeasible problem:

The supremum value may not be attained:

Use a vector variable and a vector inequality:

Univariate Problems  (7)

Unconstrained univariate polynomial maximization:

Constrained univariate polynomial maximization:

Exp-log functions:

Analytic functions over bounded constraints:

Periodic functions:

Combination of trigonometric functions with commensurable periods:

Piecewise functions:

Unconstrained problems solvable using function property information:

Multivariate Problems  (9)

Multivariate linear constrained maximization:

Linear-fractional constrained maximization:

Unconstrained polynomial maximization:

Constrained polynomial optimization can always be solved:

The maximum value may not be attained:

The objective function may be unbounded:

There may be no points satisfying the constraints:

Quantified polynomial constraints:

Algebraic maximization:

Bounded transcendental maximization:

Piecewise maximization:

Convex maximization:

Maximize concave objective function such that is positive semidefinite and :

Plot the region and the minimizing point:

Parametric Problems  (4)

Parametric linear optimization:

Coordinates of the minimizer point are continuous functions of parameters:

Parametric quadratic optimization:

Coordinates of the minimizer point are continuous functions of parameters:

Unconstrained parametric polynomial maximization:

Constrained parametric polynomial maximization:

Optimization over Integers  (3)

Univariate problems:

Integer linear programming:

Polynomial maximization over the integers:

Optimization over Regions  (6)

Maximize over a region:

Plot it:

Find points in two regions realizing the maximum distance:

Plot it:

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

Plot it:

Find the maximum for which contains the given three points:

Plot it:

Use to specify that is a vector in :

Find points in two regions realizing the maximum distance:

Plot it:

Options  (1)

WorkingPrecision  (1)

Finding an exact maximum point can take a long time:

With WorkingPrecision->200, you get an approximate maximum point:

Applications  (15)

Basic Applications  (3)

Find the lengths of sides of a unit perimeter rectangle with the maximal area:

Find the lengths of sides of a unit perimeter triangle with the maximal area:

Find the time at which a projectile reaches the maximum height:

Geometric Distances  (9)

The point q in a region that is farthest from a given point p is given by ArgMax[{Norm[p-q],q},q]. Find the farthest point in Disk[] from {1,1}:

Plot it:

Find the farthest point from {1,2} in the standard unit simplex Simplex[2]:

Plot it:

Find the farthest point from {1,1,1} in the standard unit sphere Sphere[]:

Plot it:

Find the farthest point from {-1,1,1} in the standard unit simplex Simplex[3]:

Plot it:

The diameter of a region is given by the distance between the farthest points in , which can be computed through ArgMax[Norm[p-q],{q,p}]. Find the diameter of Circle[]:

The diameter:

Plot it:

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

The diameter:

Plot it:

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

The diameter:

Plot it:

The farthest points p and q can be found through ArgMax[Norm[p-q],{p,q}]. Find the farthest points in Disk[{0,0}] and Rectangle[{3,3}]:

The farthest distance:

Plot it:

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

The farthest distance:

Plot it:

Geometric Centers  (3)

If n is a region that is full dimensional, then the Chebyshev center is the point p that maximizes -SignedRegionDistance[,p], i.e. the distance to the complement region. Find the Chebyshev center for Disk[]:

Find the Chebyshev center for Rectangle[]:

The analytic center of a region defined by inequalities =ImplicitRegion[f1[x]0fm[x]0,x] is given by ArgMax[{Log[f1[x] fm[x]],x},x]. Find the analytic center for Triangle[{{0,0},{1,0},{0,1}}]:

From the conditions above you have an inequality representation:

The analytic center:

Plot it:

Find the analytic center for Cylinder[]:

Hence you get the inequality representation:

And the analytic center:

Plot it:

Properties & Relations  (4)

Maximize gives both the value of the maximum and the maximizer point:

ArgMax gives an exact global maximizer point:

NArgMax attempts to find a global maximizer numerically, but may find a local maximizer:

FindArgMax finds a local maximizer point depending on the starting point:

The maximum point satisfies the constraints, unless messages say otherwise:

The given point maximizes the distance from the point {2,}:

When the maximum is not attained, ArgMax may give a point on the boundary:

Here the objective function tends to the maximum value when y tends to infinity:

ArgMax can solve linear optimization problems:

LinearOptimization can be used to solve the same problem by negating the objective:

Possible Issues  (2)

The maximum value may not be attained:

The objective function may be unbounded:

There may be no points satisfying the constraints:

ArgMax requires that all functions present in the input be real valued:

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

Wolfram Research (2008), ArgMax, Wolfram Language function, https://reference.wolfram.com/language/ref/ArgMax.html (updated 2021).

Text

Wolfram Research (2008), ArgMax, Wolfram Language function, https://reference.wolfram.com/language/ref/ArgMax.html (updated 2021).

CMS

Wolfram Language. 2008. "ArgMax." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ArgMax.html.

APA

Wolfram Language. (2008). ArgMax. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ArgMax.html

BibTeX

@misc{reference.wolfram_2023_argmax, author="Wolfram Research", title="{ArgMax}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ArgMax.html}", note=[Accessed: 18-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_argmax, organization={Wolfram Research}, title={ArgMax}, year={2021}, url={https://reference.wolfram.com/language/ref/ArgMax.html}, note=[Accessed: 18-March-2024 ]}