Use ode45 first for smooth nonstiff problems. Use ode23 for modest accuracy or inexpensive exploratory runs.
| Problem type | First choices | Notes |
|---|---|---|
| Nonstiff | ode45, ode23, ode113 | Start here for smooth initial value problems. |
| Stiff or mass matrix | ode15s, ode23s, ode23t, ode23tb | Use Jacobian or mass matrix options when available. |
| Fully implicit | ode15i, optional idas | Use residual form F(t,y,yp)=0. |
| Automatic object workflow | 'auto', 'autoswitch' | Select or switch between available in-tree solvers. |
Use stiff entries such as ode15s, ode23s, ode23t, or ode23tb when the solution has fast decaying modes, a mass matrix, or a useful Jacobian. These entries use a lightweight in-tree linearly implicit kernel.
Use ode15i when the equation is written as a residual F(t,y,yp)=0.
When Nelson is built with the optional SUNDIALS backend, cvodesnonstiff uses CVODES Adams for nonstiff problems, cvodesstiff uses CVODES BDF for stiff or mass-matrix problems, and idas uses IDAS BDF for fully implicit residual problems. Explicitly requesting one of these solver values reports an error when the backend is not available. If a sparse JPattern is supplied and the SPGMR library is available, the backend uses an iterative linear solver; otherwise it uses the dense linear solver. Sparse JPattern matrices and sparse double Jacobian values are consumed directly by this selection and preconditioner path. SUNDIALS solver option objects can also request LinearSolver values 'dense', 'spgmr', 'spfgmr', 'spbcgs', 'sptfqmr', 'pcg', or 'klu', and Preconditioner values 'none', 'jacobi', 'banded', or 'ilu0'. The 'auto' preconditioner chooses 'jacobi' for diagonal sparse patterns, 'banded' for narrow bands, and 'ilu0' for wider sparse patterns. The 'banded' value builds a band-limited finite-difference preconditioner and uses JPattern to restrict the band when available. The 'ilu0' value builds a compact incomplete LU preconditioner on the same sparsity pattern. The 'klu' value is conditional and is not provided by the current Windows binaries. SUNDIALS stats report linearSolver, preconditioner, sensitivityMethod, linearSetupCount, linearIterations, linearConvergenceFailures, preconditionerSetupCount, and preconditionerSolveCount.
The current object workflow supports direct forward sensitivities, CVODES adjoint gradients for scalar objectives, native IDAS adjoint gradients for scalar objectives, and projected scalar adjoint gradients for delayed equations. IDAS native adjoints report sensitivityBackend as 'idasAdjoint'. Delayed equations support positive value and slope delays, including causal function-handle delays; state-dependent delays recompute internal method-of-steps chunks from the current lag and retry with smaller chunks when a trial chunk asks for future history. Delay stats report the number of chunks through nchunks. Fully implicit delayed residuals are supported with ode15i and, when the optional backend is available, idas. 'autoswitch' runs inside the adaptive step loop and can switch between ode45 and ode15s when stiffness pressure appears or is released while preserving solution output, events, and stats. Autoswitch stats include autoSwitchInitialSolver, autoSwitchSelectedSolver, autoSwitchSwitched, autoSwitchReason, autoSwitchLastReason, autoSwitchMode, autoSwitchSwitchTime, autoSwitchSwitchCount, autoSwitchStiffnessIndicator, autoSwitchReleaseIndicator, and autoSwitchStiffnessCriterion.
options = odeset('RelTol', 1e-5);
[t, y] = ode45(@(t,y) -y, [0 1], 1, options)
f = @(t,y) -1000 * (y - cos(t)) - sin(t);
options = odeset('Jacobian', -1000);
[t, y] = ode23s(f, [0 0.5], 1, options)
| Version | Description |
|---|---|
| 2.0.0 | initial version |