Error Control for Numerical Solution of IVPs in Maple - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Differential Equations : dsolve : numeric : dsolve/numeric/Error_Control

Error Control for Numerical Solution of IVPs in Maple

Description

• 

dsolve[numeric] approximates the solution of an initial value problem (IVP) for a system of ordinary differential equations (ODEs).  Although ODEs arise in various forms, they can always be rewritten as a first order system, so to explain error control, it is assumed that the ODEs have the form

ⅆⅆxyx=fx,yx,ya=y0

  

for x in the range a..b. Here x is the independent variable and yx is the vector of dependent variables.

• 

Numerical methods solve this IVP by approximating the solution successively at a discrete set of points x0=a<x1<x2<...<xm=b. Using an approximation yi to yxi, and possibly approximations at a few xj prior to xi, an approximation yi&plus;1 is computed to yxi&plus;1.  This is called taking a step to xi&plus;1 with a step of size h&equals;xi&plus;1xi.

• 

At each step the solver makes a truncation and/or discretization error that depends on the method and the length of the step.  The cumulative effect of these errors depends on the stability of the IVP near the  solution yx. If the IVP is stable near the solution (solutions with nearby initial data do not diverge from one another), errors are not amplified, but if the IVP is unstable near the solution (solutions with nearby initial data diverge), errors are amplified.

• 

Adaptive solvers estimate the discretization error at each step and control it by adjusting the step size.  The cumulative error in the numerical solution depends on the stability of the IVP, but for moderately stable problems, the solvers are tuned so that the error is comparable to the tolerances on the discretization error.  For the efficient solution of an IVP, the solvers use the largest step size that results in a discretization error smaller than the tolerances. That is, a large step size is used if the solution is easy to approximate and a small one if it is difficult.

• 

Unfortunately, there is no "best" numerical method for IVPs. A method for which the discretization error is Ohp is said to be of order p.  If the step size h is sufficiently small, a method of higher order has a smaller discretization error. Because methods of higher order are more expensive, this is an advantage only if the tolerances are sufficiently small. For greater accuracy, use a higher order method. In particular, dsolve[rkf45] is generally more efficient than the higher order dsolve[dverk78] for modest tolerances (the default), but dsolve[dverk78] is generally more efficient for stringent tolerances.  The dsolve[lsode] code adapts the order, as well as the step size, so as to be efficient over a wide range of tolerances.

• 

The Maple numerical IVP solvers control the discretization error by means of the options abserr, relerr, minstep, maxstep, and initstep. Note that the classical methods do not estimate the discretization error or vary the step size to control it.

• 

The options that pertain to error control are:

abserr

relerr

initstep

maxstep

minstep

• 

Not all options apply to all methods, and exceptions are noted in the discussion of each option. In all cases, the default values are specific to each method. For additional information, consult the individual method help pages.

• 

abserr and relerr are tolerances for the discretization error.  abserr is an absolute error tolerance and relerr is a relative error tolerance. The exact meaning of these tolerances is dependent upon the solver. To explain this, let the dependent variables at the i-th step be yij&comma;j&equals;1..n and the estimated discretization error be approxerrj.

• 

For the rkf45, ck45, rosenbrock, the related dae extension methods, the taylorseries method, and the mebdfi method, the inequality

approxerrjabserr&plus;relerryij

  

must be satisfied for all yij simultaneously, j&equals;1..n.

  

Note: some of the solvers (all but taylorseries mentioned above) allow for a per-component absolute error tolerance, so in this case the inequality becomes:

approxerrjabserrj&plus;relerryij

• 

For the gear and dverk78 methods, the inequality

approxerrjmaxabserr&comma;relerryij

  

must be satisfied for all yij simultaneously, j&equals;1..n.

• 

lsode measures the error in the sense of root-mean-square:

j&equals;1napproxerrj2abserr&plus;relerryij2n1

• 

The other options, minstep, maxstep, and initstep, are generally intended as fine tuning options and must be used with care.

  

The minstep parameter places a minimum on the size of the steps taken by the solver, and forces an error if the solver cannot achieve the required error tolerance without reducing the step below the minimum. This can be used to recognize singularities, and can also be used to limit the cost of the of the computation, though a better way to accomplish this is to limit the number of evaluations of fx&comma;y, see dsolve[maxfun].

  

The maxstep parameter places a maximum on the size of the steps taken by the solver, so that even if the step control indicates that a larger step is possible, the size of the step will not exceed the imposed limit. This can be used to ensure that the solver does not lose the scale of the problem.

  

You can specify to the solver the scale of the problem near the initial point x&equals;a by supplying an initial step size as initstep.  The solver uses this step size if the error of the step is acceptable. Otherwise, it reduces the step size and tries again.

  

The minstep and maxstep options are not available for the solvers rkf45, ck45, rosenbrock, and the related dae extension methods, as they require control of these parameters to provide a good solution.

Examples

dsys:=&DifferentialD;2&DifferentialD;x2yx&equals;yx&comma;y0&equals;0&comma;Dy0&equals;1

dsys:=&DifferentialD;2&DifferentialD;x2yx&equals;yx&comma;y0&equals;0&comma;Dy0&equals;1

(1)

The first example solves this IVP with the default rkf45 method and default error tolerances.  The errf function measures the difference between the computed solution and the exact solution. This example shows how the error can vary over the interval of integration. The remaining examples show the effect of tighter tolerances on the error.

The rkf45 method with default error tolerances. Note that we need the option maxfun=0 to remove the limit on the number of function evaluations performed for the integration out to t=900:

dsol1:=dsolvedsys&comma;numeric&comma;maxfun&equals;0

dsol1:=procx_rkf45...end proc

(2)

errf:=x&rarr;evalfsinxrhsdsol1x2

errf:=x&rarr;evalfsinxrhsdsol1x2

(3)

errf9&comma;errf90&comma;errf900

4.4624094869272210-7&comma;0.00000891718218909432&comma;0.0000929084983034567

(4)

The following plot shows the growth of the global error over the first portion of the interval of computation.

ploterrf&comma;0..9

The rkf45 method with tighter error tolerances:

dsol2:=dsolvedsys&comma;numeric&comma;abserr&equals;1.10-8&comma;relerr&equals;1.10-8&comma;maxfun&equals;0

dsol2:=procx_rkf45...end proc

(5)

errf:=x&rarr;evalfsinxrhsdsol2x2

errf:=x&rarr;evalfsinxrhsdsol2x2

(6)

errf9&comma;errf90&comma;errf900

1.1529458443515510-8&comma;2.4253658459372210-7&comma;0.00000262007740259307

(7)

ploterrf&comma;0..9

The dverk78 method with the same tolerances.  This solver is more efficient than rkf45 at these tolerances, so it is not necessary to increase the default maxfun.

dsol3:=subsdsolvedsys&comma;numeric&comma;output&equals;listprocedure&comma;method&equals;dverk78&comma;abserr&equals;1.10-8&comma;relerr&equals;1.10-8&comma;yx

dsol3:=procx...end proc

(8)

errf:=x&rarr;evalfsinxdsol3x

errf:=x&rarr;evalfsinxdsol3x

(9)

errf9&comma;errf90&comma;errf900

4.9337569585361510-9&comma;1.6615134823538810-9&comma;4.7930324265088610-7

(10)

This solution is sufficiently accurate that, to compute the error accurately, we must use more than the default 10 digits of accuracy in Maple.

Digits:=truncevalhfDigits

ploterrf&comma;0..9

The dverk78 method with even tighter error tolerances:

dsol4:=subsdsolvedsys&comma;numeric&comma;output&equals;listprocedure&comma;method&equals;dverk78&comma;abserr&equals;1.10-10&comma;relerr&equals;1.10-10&comma;yx

dsol4:=procx...end proc

(11)

errf:=x&rarr;evalfsinxdsol4x

errf:=x&rarr;evalfsinxdsol4x

(12)

errf9&comma;errf90&comma;errf900

1.3325346381876110-10&comma;2.3488078149114210-10&comma;4.4199357507324110-9

(13)

Digits:=truncevalhfDigits

ploterrf&comma;0..9

See Also

dsolve[ck45], dsolve[classical], dsolve[dverk78], dsolve[gear], dsolve[lsode], dsolve[maxfun], dsolve[numeric,IVP], dsolve[numeric], dsolve[rkf45], dsolve[rosenbrock], dsolve[taylorseries]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam