Wolfram Research

Function Repository Resource:

StationaryPoints

Source Notebook

Compute the stationary points of a function of one or more variables

Contributed by: Paco Jain (Wolfram Research)

ResourceFunction["StationaryPoints"][expr, {var1,var2, }]

computes the stationary points of expr with respect to the variable(s) vari.

ResourceFunction["StationaryPoints"][{expr,domain},{var1,var2,}]

computes the stationary points of expr that lie within the domain domain.

Details and Options

Results of ResourceFunction["StationaryPoints"][expr, {var1, }] are returned in the form {{val1, {var11 sol12,}}, }, where {vari1 soli1,} represents the location of the ith stationary point and vali is the value of expr at that point.
Results can be limited to one type of stationary point or another by including the option setting Type -> “Maximum”, Type -> “Minimum”, or Type -> “SaddlePoint”. Omitting this option or using Type -> Automatic returns all stationary points.
For functions with a repeating pattern of inflection points, InflectionPoints returns results in terms of one or more undetermined constants, which can take any integer value.

Examples

Basic Examples

Find the stationary points of a function of one variable:

In[1]:=
ResourceFunction[
 "StationaryPoints"][(4 E^-t^2 Erf[t])/Sqrt[\[Pi]], {t}]
Out[1]=

Find the stationary points of a periodic function:

In[2]:=
ResourceFunction["StationaryPoints"][Sin[x], {x}]
Out[2]=
In[3]:=
ResourceFunction["StationaryPoints"][Sin[x] Cos[x] - Tan[x], {x}]
Out[3]=

Find the stationary points of a function over a restricted domain

:

In[4]:=
ResourceFunction["StationaryPoints"][{Sin[x], -4 <= x <= 4}, {x}]
Out[4]=
In[5]:=
ResourceFunction[
 "StationaryPoints"][{Sin[x] Cos[x] - Tan[x], -10 <= x <= 10}, {x}]
Out[5]=
In[6]:=
ResourceFunction[
  "StationaryPoints"][{(9 (4 x^2 Sin[x^2] - 2 Cos[x^2]))/5000, 0 < x < 1}, {x}] // N
Out[6]=

Find stationary points of a function of two variables:

In[7]:=
ResourceFunction["StationaryPoints"][(3 x + 1) y^3 + x^2 y, {x, y}]
Out[7]=

Find stationary points of a function of three variables when restricting to a plane:

In[8]:=
ResourceFunction[
 "StationaryPoints"][{x y z, x + y + z == 100}, {x, y, z}]
Out[8]=

Options

Using the Type option will return only stationary points of the given type:

In[9]:=
ResourceFunction[
 "StationaryPoints"][-x^4 + 15 x^2 + 1 + -y^4 + 15 y^2 + 1 , {x, y}, "Type" -> "Minimum"]
Out[9]=
In[10]:=
ResourceFunction[
 "StationaryPoints"][-x^4 + 15 x^2 + 1 + -y^4 + 15 y^2 + 1, {x, y}, "Type" -> "Maximum"]
Out[10]=
In[11]:=
ResourceFunction[
 "StationaryPoints"][{Exp[x] Sin[y], x^2 + y^2 == 1}, {x, y}, "Type" -> "Maximum"]
Out[11]=
In[12]:=
ResourceFunction[
 "StationaryPoints"][{Exp[x] Sin[y], x^2 + y^2 == 1}, {x, y}, "Type" -> "Minimum"]
Out[12]=

Using the Type Automatic returns all stationary points:

In[13]:=
ResourceFunction[
 "StationaryPoints"][{Exp[x] Sin[y], x^2 + y^2 == 1}, {x, y}, "Type" -> Automatic]
Out[13]=

Properties and Relations

StationaryPoints will sometimes return results in terms of Root objects:

In[14]:=
ResourceFunction[
 "StationaryPoints"][{Sin[x + Sqrt[2] Sin[x^2]], -\[Pi] < x < \[Pi]}, {x}, "Type" -> "Minimum"]
Out[14]=

Results such as these can be numericized by applying N:

In[15]:=
% // N
Out[15]=

For functions with a repeating pattern of stationary points, StationaryPoints returns results in terms of one or more undetermined constants, which can take any integer value:

In[16]:=
ResourceFunction["StationaryPoints"][Sin[1/x], {x}]
Out[16]=

Possible Issues

For functions having one or more classes of non-isolated inflection points, StationaryPoints[expr] may return only isolated examples:

In[17]:=
ResourceFunction["StationaryPoints"][Sin[x^3 y^3], {x, y}]
Out[17]=

Resource History

See Also

License Information