NMaxValue

NMaxValue[f,x]

gives the maximum value of f with respect to x.

NMaxValue[f,{x,y,}]

gives the maximum value of f with respect to x, y, .

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

gives the maximum value of f subject to the constraints cons.

NMaxValue[,xreg]

constrains x to be in the region reg.

Details and Options

  • NMaxValue[] is effectively equivalent to First[NMaximize[]].
  • cons can contain equations, inequalities or logical combinations of these.
  • The constraints cons can be any logical combination of:
  • lhs==rhsequations
    lhs>rhs or lhs>=rhs inequalities
    {x,y,}regregion specification
  • NMaxValue[{f,cons},xreg] is effectively equivalent to NMaxValue[{f,consxreg},x].
  • For xreg, the different coordinates can be referred to using Indexed[x,i].
  • NMaxValue 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, NMaxValue can always find global maxima, over both real and integer values.
  • Otherwise, NMaxValue may sometimes find only a local maximum.
  • If NMaxValue determines that the constraints cannot be satisfied, it returns -Infinity.
  • NMaxValue takes the same options as NMaximize.

Examples

open allclose all

Basic Examples  (5)

Find the maximum value of a univariate function:

Find the maximum value of a multivariate function:

Find the maximum value of a function subject to constraints:

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

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

Scope  (9)

Or constraints can be specified:

Use NMaxValue for linear objective and constraints:

Integer constraints can be imposed:

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

Plot it:

Find the maximum distance between points in two regions:

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

Plot it:

Find the maximum for which contains the given three points:

Use to specify that is a vector in :

Find the maximum distance between points in two regions:

Applications  (1)

Find the maximal area among rectangles with a unit perimeter:

Properties & Relations  (3)

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

NMaxValue gives the maximum:

NArgMax gives the maximizer point:

NMaxValue can solve linear programming problems:

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

Use RegionBounds to compute the bounding box:

Use NMaxValue and NMinValue to compute the same bounds:

Introduced in 2008
 (7.0)
 |
Updated in 2014
 (10.0)