"StiffnessSwitching" Method for NDSolve


The basic idea behind the method is to provide an automatic means of switching between a nonstiff and a stiff solver.

The and options (described within "Stiffness Detection in NDSolve") provides a useful means of detecting when a problem appears to be stiff.

The method traps any failure code generated by and switches to an alternative solver. The method also uses the method specified in the option to switch back from a stiff to a nonstiff method.

provides a powerful technique for computing highly accurate solutions using dynamic order and step size selection (see "Extrapolation Method for NDSolve" for more details) and is therefore used as the default choice in .


This loads some useful packages.
Click for copyable input
This selects a stiff problem and specifies a longer integration time interval than the default specified by .
Click for copyable input
The default base method is not appropriate for stiff problems and gives up quite quickly.
Click for copyable input
Instead of giving up, the method continues the integration with a stiff solver.
Click for copyable input

The method uses a pair of extrapolation methods as the default. The nonstiff solver uses the base method, and the stiff solver uses the base method.

For small values of the AccuracyGoal and PrecisionGoal tolerances, it is sometimes preferable to use an explicit Runge-Kutta method for the nonstiff solver.

The method eventually gives up when the problem is considered to be stiff.
Click for copyable input
This sets the method as a submethod of .
Click for copyable input
A switch to the stiff solver occurs at , and a plot of the step sizes used shows that the stiff solver takes much larger steps.
Click for copyable input

Option Summary

option name
default value
Method{Automatic,Automatic}specify the methods to use for the nonstiff and stiff solvers respectively
"NonstiffTest"Automaticspecify the method to use for deciding whether to switch to a nonstiff solver

Options of the method .

New to Mathematica? Find your learning path »
Have a question? Ask support »