Method of Steepest Descent

Author

Eric W. Weisstein
April 27, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Optimization/MethodofSteepestDescent.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/MethodofSteepestDescent.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Function

f[x_]:=x^3-2x^2+2

Solve[f'[y]==0,y]

Code

SteepestDescent[f_,x0_:0,n_:20,eps_:.1]:=Module[{x=NestList[#-eps f'[#]&,x0,n]},
Transpose[{x,f/@x}]
]

Figure

Show[GraphicsArray[
{
{Plot[f[x],{x,-1,2.5},
AxesLabel->{HoldForm[x],HoldForm[f[x]]}]},
Plot[f[x],{x,#[[1,1]],#[[1,2]]},Epilog->{Red,PointSize[.03],Point/@#[[2]],Line[#[[2]]],
Blue,Dashing[{.02}],Line[{{4/3,-10},{4/3,10}}]},
AxesLabel->{HoldForm[x],HoldForm[f[x]]},
PlotLabel->HoldForm[(Subscript[x, 0])]==#[[3]],
PlotRange->All]&/@{
{{1,2},SteepestDescent[f,2,20,.1],2},
{{-1,2},SteepestDescent[f,.01,30,.1],.01}
}
}
]]