#General API for all solvers This is a working draft for how the API might look like in the future
Please open pull requests or issues to propose changes or clarifications.
##Basic interface The general interface for all ODE solvers is:
t_out, y_out = odeXX(F, y0, tspan; kwargs...)
Each (adaptive) solver accepts 3 arguments
F
: the RHS of the ODEdy/dt = F(t,y)
, which is a function oft
andy(t)
and returnsdy/dt::typeof(y/t)
y0
: initial value fory
. The type ofy0
, promoted as necessary according to the numeric type used for the times, determines the element type of theyout
vector (yout::Vector{typeof(y0*one(t))}
)tspan
: Any iterable of sortedt
values at which the solution (y
) is requested. Most solvers will only considertspan[1]
andtspan[end]
, and intermediary points will be interpolated. Iftspan[1] > tspan[end]
the integration is performed backwards. The times are promoted as necessary to a common floating-point type.
The solver returns two arrays
tout
: Vector of points at which solutions were obtained (also see keywordpoints
)yout
: solutions at timestout
, stored as a vectoryout
as described above. Note that ify0
is a vector, you can get a matlab-like matrix withhcat(yout...)
.
Each solver might implement its own keywords, but the following keywords have a standardized interpretation across all solvers. Solvers should raise an error if a unrecognized keyword argument is used.
norm
: user-supplied norm for determining the errorE
(defaultBase.vecnorm
)abstol
and/orreltol
: an integration step is accepted ifE <= abstol || E <= reltol*abs(y)
(ideally we want both criteria for all solvers, done in #13)points=:all | :specified
: controls the type of output according to
points==:all
(default) output is given for each value intspan
as well as for each intermediate point the solver used.points==:specified
output is given only for each value intspan
.
maxstep
,minstep
andinitstep
: determine the maximal, minimal and initial integration step.retries = 0
Sometimes an integration step takes you out of the region whereF(t,y)
has a valid solution and F might throwDomainError
or other exceptions.retries
sets a limit to the number of times the solver might try with a smaller step.
##Iterator interface Under construction #27