Common Solver Options

Common Solver Options

The DifferentialEquations.jl universe has a large set of common arguments available for the solve function. These arguments apply to solve on any problem type and are only limited by limitations of the specific implementations.

Many of the defaults depend on the algorithm or the package the algorithm derives from. Not all of the interface is provided by every algorithm. For more detailed information on the defaults and the available options for specific algorithms / packages, see the manual pages for the solvers of specific problems. To see whether a specific package is compaible with the use of a given option, see the Solver Compatibility Chart

Default Algorithm Hinting

To help choose the default algorithm, the keyword argument alg_hints is provided to solve. alg_hints is a Vector{Symbol} which describe the problem at a high level to the solver. The options are:

Currently unused options include:

This functionality is derived via the benchmarks in DiffEqBenchmarks.jl and is under active development.

SDE Specific

Output Control

These arguments control the output behavior of the solvers. It defaults to maximum output to give the best interactive user experience, but can be reduced all the way to only saving the solution at the final timepoint.

The following options are all related to output control. See the "Examples" section at the end of this page for some example usage.

Note that dense requires save_everystep=true and saveat=false. If you need additional saving while keeping dense output, see the SavingCallback in the Callback Library.

Stepsize Control

These arguments control the timestepping routines.

Basic Stepsize Control

These are the standard options for controlling stepping behavior. Error estimates do the comparison

\[err_{scaled} = err/(abstol + max(uprev,u)*reltol)\]

The scaled error is guaranteed to be <1 for a given local error estimate (note: error estimates are local unless the method specifies otherwise). abstol controls the non-scaling error and thus can be though of as the error around zero. reltol scales with the size of the dependent variables and so one can interpret reltol=1e-3 as roughly being (locally) correct to 3 digits. Note tolerances can be specified element-wise by passing a vector whose size matches u0.

Fixed Stepsize Usage

Note that if a method does not have adaptivity, the following rules apply:

Advanced Adaptive Stepsize Control

These arguments control more advanced parts of the internals of adaptive timestepping and are mostly used to make it more efficient on specific problems. For detained explanations of the timestepping algorithms, see the timestepping descriptions


Progress Monitoring

These arguments control the usage of the progressbar in the Juno IDE.

User Data

Error Calculations

If you are using the test problems (ex: ODETestProblem), then the following options control the errors which are calculated:


The following lines are examples of how one could use the configuration of solve(). For these examples a 3-dimensional ODE problem is assumed, however the extention to other types is straightforward.

  1. solve(prob, AlgorithmName()) : The "default" setting, with a user-specified

algorithm (given by AlgorithmName()).All parameters get their default values. This means that the solution is saved at the steps the Algorithm stops internally and dense output is enabled if the chosen algorithm allows for it. All other integration parameters (e.g. stepsize) are chosen automatically.

  1. solve(prob, saveat = 0.01, abstol = 1e-9, reltol = 1e-9) : Standard setting

for accurate output at specified (and equidistant) time intervals, used for e.g. Fourier Transform. The solution is given every 0.01 time units, starting from tspan[1]. The solver used is Tsit5() since no keyword alg_hits is given.

  1. solve(prob, maxiters = 1e7, progress = true, save_idxs = [1]) : Using longer

maximum number of solver iterations can be useful when a given tspan is very long. This example only saves the first of the variables of the system, either to save size or because the user does not care about the others. Finally, with progress = true you are enabling the progress bar, provided you are using the Atom+Juno IDE set-up for your Julia.