Function Repository Resource:

StationaryPoints

Source Notebook

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

Contributed by: Wolfram|Alpha Math Team

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

computes the stationary points of expr with respect to the variables vari.

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

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

ResourceFunction["StationaryPoints"][, "type"]

limits the stationary points returned to those of the given type.

Details and Options

Allowed values of the optional "type" argument are "Maxima", "Minima", and "SaddlePoints". Using Automatic or omitting the "type" argument returns an Association of stationary points keyed according to their types.
ResourceFunction["StationaryPoints"][expr,{var1,},"type"] returns a list of results, each of the form {valj,{var1sol1j,val2sol2j}}, where the list of rules represents the location of the jth stationary point and valj is the value of expr at that point.
For functions with a repeating pattern of stationary points, ResourceFunction["StationaryPoints"] returns results in terms of one or more undetermined constants ci, which can take any integer value.
In ResourceFunction["StationaryPoints"][{expr,domain},], the argument domain should be a Boolean expression, typically an equality, inequality or logical combination thereof, involving the vari.

Examples

Basic Examples (7) 

Find the stationary points of a function of one variable:

In[1]:=
statPoints = ResourceFunction[
  "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][t^2 Exp[-t^2], {t}]
Out[1]=

Plot the function and its stationary points found above:

In[2]:=
Plot[t^2 Exp[-t^2], {t, -5, 5}, Epilog -> Join[{Red, PointSize@Large}, Point[{#[[2, 1, 2]], #[[1]]}] & /@ Flatten[Values[statPoints], 1]]]
Out[2]=

Find the stationary points of a periodic function:

In[3]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][Sin[x], {x}]
Out[3]=
In[4]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][Sin[x] Cos[x] - Tan[x], {x}]
Out[4]=

Find the stationary points of a function over a restricted domain:

In[5]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][{Sin[x], -4 <= x <= 4}, {x}]
Out[5]=
In[6]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][{Sin[x] Cos[x] - Tan[x], -10 <= x <= 10}, {x}]
Out[6]=

Find the stationary points of a function of two variables:

In[7]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][(3 x + 1) y^3 + x^2 y, {x, y}]
Out[7]=

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

In[8]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][{x y z, x + y + z == 100}, {x, y, z}]
Out[8]=

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

In[9]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][-x^4 + 15 x^2 + 1 + -y^4 + 15 y^2 + 1 , {x, y}, "Minima"]
Out[9]=
In[10]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][-x^4 + 15 x^2 + 1 + -y^4 + 15 y^2 + 1, {x, y}, "Maxima"]
Out[10]=
In[11]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][{Exp[x] Sin[y], x^2 + y^2 == 1}, {x, y}, "Type" -> "Minimum"]
Out[11]=

Using Automatic as the second argument gives an Association of all stationary points:

In[12]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][-x^4 + 15 x^2 + 1 + -y^4 + 15 y^2 + 1 , {x, y}, Automatic]
Out[12]=

Properties and Relations (2) 

StationaryPoints will sometimes return results in terms of Root objects:

In[13]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][{Sin[x + Sqrt[2] Sin[x^2]], -\[Pi] < x < \[Pi]}, {x}, "Type" -> "Minimum"]
Out[13]=

Results such as these can be numericized by applying N:

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

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

In[15]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][Sin[1/x], {x}]
Out[15]=

Possible Issues (2) 

For functions possessing one or more families of non-isolated stationary points, StationaryPoints may return only the isolated stationary points. For example, the function sin(x3y3) has lines of stationary points along both the x and y axes, as can be seen in the following plot:

In[16]:=
Plot3D[Sin[x^3 y^3], {x, -2, 2}, {y, -2, 2}, PlotPoints -> 100]
Out[16]=

These, however, are excluded from the results of StationaryPoints:

In[17]:=
ResourceFunction[
 "StationaryPoints", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][Sin[x^3 y^3], {x, y}]
Out[17]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 6.0.0 – 23 March 2023
  • 5.0.0 – 08 April 2020
  • 4.0.0 – 06 September 2019
  • 3.0.0 – 12 June 2019
  • 2.0.0 – 12 June 2019
  • 1.0.0 – 22 February 2019

Related Resources

License Information