dsolve/numeric/lsode/advanced
numerical solution of ordinary differential equations
Calling Sequence
Parameters
Description
Examples
dsolve(odesys, numeric, method=lsode, options)
dsolve(odesys, numeric, method=lsode[choice], vars, options)
dsolve(numeric, method=lsode[choice], vars, options)
odesys
-
set or list; ordinary differential equation(s) and initial conditions
numeric
literal name; instruct dsolve to find a numerical solution
method=lsode
literal equation; numerical method to use
method=lsode[choice]
literal equation; numerical method and submethod to use
vars
(optional) dependent variable or a set or list of dependent variables for odesys
options
(optional) equations of the form keyword = value
This page describes the advanced use form of the lsode method for the numerical solution of ODE initial value problems. The general usage of this method, including the choice of the submethod, is described in dsolve[lsode].
The advanced use optional equations for method=lsode are as follows:
'itask'
=
integer
'ctrl'
array
The itask parameter is an integer index specifying the type of task to be performed. It can have the following values:
Value
Meaning
1
normal computation of output values of y⁡t (by overshooting the endpoint and interpolating)
2
take one step only and return
3
stop at the first internal mesh point at or beyond the endpoint and return
4
normal computation of output values of y⁡t at the endpoint without overshooting tcrit (tcrit is the critical time value that integration should not pass; it can be equal to or beyond the endpoint, but must not be behind the endpoint in the direction of integration)
5
means take one step without passing tcrit and return
The default value is 1.
The ctrl parameter c is a vector of floating-point numbers and integers with length at least 21+neqns (where neqns is the number of equations in the system to be considered). The first 11 values are optional inputs, and the remaining positions are reserved for optional output values. The correspondence of meanings and individual vector elements is as follows:
Inputs:
c1=rtol where rtol is a relative error tolerance parameter. The default value is Float(1,-7).
c2=atol where atol is an absolute error tolerance parameter. The values of atol and rtol determine the error control performed by the solver. The solver will control a vector e⁡i of estimated local errors in y according to an inequality of the form rms-norm of e⁡iewt⁡i≤1, where ewt⁡i=rtol⁢y⁡i+atol and rms-norm is the root-mean-square norm. Use rtol=0 for absolute error checking, and atol=0 for relative error checking. The default for atol is Float(1,-7).
c3=tcrit where tcrit is the critical independent variable value which must not be passed (only used for itask = 4 or 5). Its default value is x0+0.1.
c4=μ where mu is the upper half-bandwidth required for banded Jacobian methods excluding the main diagonal.
c5=ml where ml is the lower half-bandwidth required for banded Jacobian methods excluding the main diagonal. The band is defined by the matrix locations: for row i and column j with i−ml<=j<=i+mu. ml and mu must satisfy 0≤ml, μ≤neqns−1.
c6=h0 where h0 is the step size to attempt on the first step. If h0 is not specified, the default value is determined by the solver.
c7=hmax where hmax is the maximum absolute step size allowed. The default value is infinite.
c8=hmin where hmin is the minimum absolute step size allowed. The default value is zero (Note: This lower bound is not enforced on the final step before reaching tcrit on itask=4 or 5).
c9=maxord where maxord is the maximum order to be allowed. The default value is 12 for Adams methods and 5 for backward differentiation. If maxord exceeds these defaults, it will be reduced to the appropriate value.
c10=mxstep where mxstep is the maximum number of (internally defined) steps allowed during one call to the solver. The default value is 500.
c11=mxhnil where mxhnil is the maximum number of error conditions of t+h=t of a step. The default value is 10.
Outputs:
c12=istate where istate can have the following values on output:
nothing was done as tout was equal to t on input
the integration was performed successfully
−1
an excessive amount of work (more than mxstep steps) was done during the call before completing the requested task
−2
too much accuracy was requested for the precision of the machine being used
−3
illegal input was detected before taking any steps
−4
there was repeated error test failures on one attempted step (the problem may have a singularity)
−5
there were repeated convergence test failures on one attempted step (this may be caused by an inaccurate Jacobian matrix if being used)
−6
indicates ewt⁡i became zero for some i during the integration (i.e., pure absolute error control was requested on a variable that has now vanished)
c13=hu where hu is the step size in t last used.
c14=hcur where hcur is the step size that was to be attempted on the next step.
c15=tcur where tcur is the current value of the independent variable which the solver has actually reached (i.e., the current internal mesh point in t). At output tcur will always be at least as far as the argument, t, but may be farther (if interpolation was done).
c16=tolsf where tolsf is a tolerance scale factor greater than 1.0, computed when a request for too much accuracy was detected (istate=−3 or −2). If rtol and atol are scaled up by a factor of tolsf for another call, then the solver is deemed likely to succeed.
c17=nst where nst is the number of steps taken for the problem so far.
c18=nfe where nfe is the number of function (differential system) evaluations for the problem so far.
c19=nje where nje is the number of Jacobian evaluations for the problem so far.
c20=nqu where nqu is the method order last used (successfully).
c21=nqcur where nqcur is the order that was to be attempted on the next step.
c22..21+neqns=acor1..neqns where acor is an array of size neqns used for the accumulated corrections on each step scaled on output to represent the estimated local error in y on the last step. It is defined only on a successful return from lsode.
C≔array⁡`$`⁡0,26:
C3≔0.75:
C4≔1:
C5≔1:
C10≔2500:
deq1≔diff⁡v⁡t,`$`⁡t,5−diff⁡v⁡t,`$`⁡t,2=v⁡t−t
deq1≔ⅆ5ⅆt5v⁡t−ⅆ2ⅆt2v⁡t=v⁡t−t
init1≔v⁡0=0.25,D⁡v⁡0=0.75,D2⁡v⁡0=1,D3⁡v⁡0=0,D4⁡v⁡0=−0.25
ans1≔dsolve⁡deq1,init1,numeric,method=lsodebackband,ctrl=C:
ans1⁡0.65
t=0.65,v⁡t=0.948081855882857,ⅆⅆtv⁡t=1.39770380574707,ⅆ2ⅆt2v⁡t=1.00339524678793,ⅆ3ⅆt3v⁡t=0.0968760633151896,ⅆ4ⅆt4v⁡t=0.553051343710615
See Also
dsolve/Error_Control
dsolve[ck45]
dsolve[classical]
dsolve[dverk78]
dsolve[gear]
dsolve[lsode]
dsolve[maxfun]
dsolve[numeric,IVP]
dsolve[numeric]
dsolve[rkf45]
dsolve[rosenbrock]
dsolve[Stiffness]
dsolve[taylorseries]
plots[odeplot]
Download Help Document