StepMonitor

StepMonitor
is an option for iterative numerical computation functions that gives an expression to evaluate whenever a step is taken by the numerical method used.

DetailsDetails

  • The option setting is normally given as StepMonitor:>expr.
  • The is used instead of to avoid expr being immediately evaluated.
  • Whenever expr is evaluated, all variables in the numerical computation are assigned their current values.
  • Block[{var1=val1,},expr] is effectively used.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Monitor steps taken for a numerical minimization with FindMinimum:

In[1]:=
Click for copyable input
Out[1]=

Count steps:

In[1]:=
Click for copyable input
Out[1]=

Use Reap and Sow to collect step data:

In[1]:=
Click for copyable input
Out[1]=

Show steps on a plot of the function:

In[2]:=
Click for copyable input
Out[2]=
Introduced in 2003
(5.0)