This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

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.
  • 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 is effectively used.
Monitor steps taken for a numerical minimization with FindMinimum:
Count steps:
Use Reap and Sow to collect step data:
Show steps on a plot of the function:
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]=
Monitor the solution progress when solving the sine-Gordon PDE:
Monitor steps taken to numerically solve a system of equations:
Show steps on a surface plot of the functions:
Steps in parameter space for a nonlinear fit:
Sequence of plots showing the evolution of the model over the steps:
Plot the spatial (x) solution for time (t) steps used numerically solving a PDE with NDSolve:
Show the steps with a surface plot of the solution:
Show how precision is adapted for high-precision root finding:
The quadratic convergence of Newton's method allows eventual precision doubling at each step:
Investigate steps and evaluations for a numerical minimization:
Show evaluations in red, steps in yellow, and the final point in green:
Get step sizes for the numerical solution of an ODE with NDSolve:
Show the solution and step size as a function of t:
Compare steps, evaluations, and timing for different ODE integration methods in NDSolve:
New in 5