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.
Details

- 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.
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Monitor steps taken for a numerical minimization with FindMinimum:

https://wolfram.com/xid/0i1inhsc6-wpgbe


https://wolfram.com/xid/0i1inhsc6-jn7hhw

Use Reap and Sow to collect step data:

https://wolfram.com/xid/0i1inhsc6-qke2ip

Show steps on a plot of the function:

https://wolfram.com/xid/0i1inhsc6-hnw524

Scope (4)Survey of the scope of standard use cases
Monitor the solution progress when solving the sine-Gordon PDE:

https://wolfram.com/xid/0i1inhsc6-8v3nl

Monitor steps taken to numerically solve a system of equations:

https://wolfram.com/xid/0i1inhsc6-bchsqj

Show steps on a surface plot of the functions:

https://wolfram.com/xid/0i1inhsc6-e1501m

https://wolfram.com/xid/0i1inhsc6-l9x6zq

Steps in parameter space for a nonlinear fit:

https://wolfram.com/xid/0i1inhsc6-wteui

https://wolfram.com/xid/0i1inhsc6-bed63a

https://wolfram.com/xid/0i1inhsc6-d7c8c7

Sequence of plots showing the evolution of the model over the steps:

https://wolfram.com/xid/0i1inhsc6-i3mqo

Plot the spatial (x) solution for time (t) steps used numerically solving a PDE with NDSolve:

https://wolfram.com/xid/0i1inhsc6-flia3x

https://wolfram.com/xid/0i1inhsc6-klx0oh

Show the steps with a surface plot of the solution:

https://wolfram.com/xid/0i1inhsc6-kxt05c

Applications (4)Sample problems that can be solved with this function
Show how precision is adapted for high-precision root finding:

https://wolfram.com/xid/0i1inhsc6-h5yjc

https://wolfram.com/xid/0i1inhsc6-baywch
The quadratic convergence of Newton's method allows eventual precision doubling at each step:

https://wolfram.com/xid/0i1inhsc6-d5ntyu

Investigate steps and evaluations for a numerical minimization:

https://wolfram.com/xid/0i1inhsc6-fhvgeh

Show evaluations in red, steps in yellow, and the final point in green:

https://wolfram.com/xid/0i1inhsc6-f3hjzg

Get step sizes for the numerical solution of an ODE with NDSolve:

https://wolfram.com/xid/0i1inhsc6-fv8fej
Show the solution and step size as a function of t:

https://wolfram.com/xid/0i1inhsc6-emjuaa

Compare steps, evaluations, and timing for different ODE integration methods in NDSolve:

https://wolfram.com/xid/0i1inhsc6-2xsju

https://wolfram.com/xid/0i1inhsc6-bxrzb6

https://wolfram.com/xid/0i1inhsc6-g3c7re

Wolfram Research (2003), StepMonitor, Wolfram Language function, https://reference.wolfram.com/language/ref/StepMonitor.html.
Text
Wolfram Research (2003), StepMonitor, Wolfram Language function, https://reference.wolfram.com/language/ref/StepMonitor.html.
Wolfram Research (2003), StepMonitor, Wolfram Language function, https://reference.wolfram.com/language/ref/StepMonitor.html.
CMS
Wolfram Language. 2003. "StepMonitor." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/StepMonitor.html.
Wolfram Language. 2003. "StepMonitor." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/StepMonitor.html.
APA
Wolfram Language. (2003). StepMonitor. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StepMonitor.html
Wolfram Language. (2003). StepMonitor. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StepMonitor.html
BibTeX
@misc{reference.wolfram_2025_stepmonitor, author="Wolfram Research", title="{StepMonitor}", year="2003", howpublished="\url{https://reference.wolfram.com/language/ref/StepMonitor.html}", note=[Accessed: 11-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_stepmonitor, organization={Wolfram Research}, title={StepMonitor}, year={2003}, url={https://reference.wolfram.com/language/ref/StepMonitor.html}, note=[Accessed: 11-March-2025
]}