dverk78 - Maple Help

dsolve/numeric/dverk78

numerical solution of ordinary differential equations

 Calling Sequence dsolve($\mathrm{odesys}$, numeric, method=dverk78, vars, options) dsolve(numeric, method=dverk78, procopts, options)

Parameters

 odesys - set or list; ordinary differential equation(s) and initial conditions numeric - literal name; instruct dsolve to find a numerical solution method=dverk78 - literal equation; numerical method to use vars - (optional) dependent variable or a set or list of dependent variables for odesys options - (optional) equations of the form keyword = value procopts - options used to specify the ODE system using a procedure (procedure, initial, start, number, and procvars). For more information, see dsolve[numeric,IVP].

Description

 • The dsolve command with options numeric and method=dverk78 finds a numerical solution using a seventh-eighth order continuous Runge-Kutta method.
 • The following options are available for the basic use form of the dverk78 method:

 'output'      = keyword or array 'known'       = name or list of names 'number'      = integer 'procedure'   = procedure 'start'       = numeric 'initial'     = array 'procvars'    = list 'startinit'   = boolean 'implicit'    = boolean 'optimize'    = boolean 'abserr'      = numeric 'relerr'      = numeric 'errorest'    = symbol 'initstep'    = numeric 'minstep'     = numeric 'maxstep'     = numeric 'maxfun'      = integer

 'output'
 Specifies the desired output from dsolve, and the known option specifies user-defined known functions. For more information, see dsolve[numeric].
 'number', 'procedure', 'start', 'initial', and 'procvars'
 These options are used to specify the IVP using procedures. For more information, see dsolve[numeric,IVP].
 'startinit','implicit', and 'optimize'
 These options control the method and behavior of the computation. For more information on the first two, see dsolve[numeric,IVP], for the last, see dsolve[numeric].
 'abserr', 'relerr', 'initstep', 'minstep', and 'maxstep'
 Specify the desired accuracy of the solution, and allow for more detailed control of the step size. For more information, see dsolve[Error_Control]. The default values are $\mathrm{abserr}=1.×{10}^{-8}$, $\mathrm{relerr}=1.×{10}^{-8}$, $\mathrm{minstep}=0$, $\mathrm{maxstep}=2.0$, and $\mathrm{initstep}=\mathrm{maxstep}{\mathrm{relerr}}^{1}{6}}$.
 The dverk78 method is capable of working in arbitrary precision based on the setting of Digits, and can be used to obtain high accuracy solutions for ODE systems. As a note of caution, however, it is often necessary to work with a greater number of Digits than would be expected for the requested error tolerance, to prevent round-off error from giving an inaccurate error estimate. When the error tolerance is too strict for the current setting of Digits, it is detected by the algorithm, and an error is issued. Asymptotically dverk78 requires Digits set so that $\mathrm{tol}=\mathrm{O}\left({\mathrm{Float}\left(1,-\mathrm{Digits}\right)}^{9}{8}}\right)$.
 Note: As for all other numeric dsolve methods, any setting of Digits that is less than or equal to hardware precision works in hardware precision, so for $\mathrm{Digits}<\mathrm{evalhf}\left(\mathrm{Digits}\right)$, the algorithm works in $\mathrm{trunc}\left(\mathrm{evalhf}\left(\mathrm{Digits}\right)\right)$ Digits (see evalhf).
 'errorest'
 Allows control over the method used to obtain error estimates, and can have the values $\mathrm{interpolant}$ or pair. The $\mathrm{interpolant}$ option is the default, and tells dverk78 to estimate the error using the interpolant of the method. The pair option tells dverk to estimate the error using the difference between the computed solution and a lower order estimate of the solution (hence 'pair'). Typically, the $\mathrm{interpolant}$ option gives a better error estimate than the pair option, but requires more work to compute. This may also be a better option for expensive systems, as dverk78 with the $\mathrm{interpolant}$ option performs 20 function evaluations per step, while the pair option only requires 13.
 'maxfun'
 An integer that specifies the maximum on the number of evaluations of the ODE or ODE system in one call to the returned procedure. This limits the amount of work done on any individual call (See dsolve[maxfun]). This option is relevant for the procedure-style output only. By default, this value is set to zero (disabled).
 • Results can be plotted using the function odeplot in the plots package.

Examples

Default output at several points

 > $\mathrm{dsol1}≔\mathrm{dsolve}\left(\left\{y\left(0\right)=1,\mathrm{D}\left(y\right)\left(x\right)=y\left(x\right)\right\},\mathrm{numeric},\mathrm{method}=\mathrm{dverk78},\mathrm{abserr}=1.×{10}^{-8},\mathrm{relerr}=1.×{10}^{-8}\right)$
 ${\mathrm{dsol1}}{≔}{\mathbf{proc}}\left({\mathrm{x_dverk78}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (1)
 > $\mathrm{dsol1}\left(0\right)$
 $\left[{x}{=}{0.}{,}{y}{}\left({x}\right){=}{1.}\right]$ (2)
 > $\mathrm{dsol1}\left(0.4\right)$
 $\left[{x}{=}{0.400000000000000}{,}{y}{}\left({x}\right){=}{1.49182469764117}\right]$ (3)
 > $\mathrm{dsol1}\left(1.2\right)$
 $\left[{x}{=}{1.20000000000000}{,}{y}{}\left({x}\right){=}{3.32011692267802}\right]$ (4)
 > $\mathrm{dsol1}\left(1.5\right)$
 $\left[{x}{=}{1.50000000000000}{,}{y}{}\left({x}\right){=}{4.48168906989179}\right]$ (5)

array output

 > $\mathrm{dsys2}≔\left\{\mathrm{diff}\left(x\left(t\right),t\right)=-y\left(t\right),\mathrm{diff}\left(y\left(t\right),t\right)=x\left(t\right)\right\}$
 ${\mathrm{dsys2}}{≔}\left\{\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{x}{}\left({t}\right){=}{-}{y}{}\left({t}\right){,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{x}{}\left({t}\right)\right\}$ (6)
 > $\mathrm{init2}≔\left\{x\left(0\right)=1,y\left(0\right)=0\right\}$
 ${\mathrm{init2}}{≔}\left\{{x}{}\left({0}\right){=}{1}{,}{y}{}\left({0}\right){=}{0}\right\}$ (7)
 > $\mathrm{dsol2}≔\mathrm{dsolve}\left(\mathrm{dsys2}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{union}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{init2},\mathrm{numeric},\mathrm{method}=\mathrm{dverk78},\mathrm{output}=\mathrm{Array}\left(\left[0,0.7,1.1,1.5,2.2,2.5\right]\right)\right)$
 ${\mathrm{dsol2}}{≔}\left[\begin{array}{c}{\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[\left[\begin{array}{ccc}t& x{}\left(t\right)& y{}\left(t\right)\end{array}\right]\right]\right)\\ {\mathrm{Typesetting}}{:-}{\mathrm{_Hold}}{}\left(\left[\left[\begin{array}{ccc}0.& 1.& 0.\\ 0.7& 0.7648421872847913& 0.6442176872371348\\ 1.1& 0.4535961215337577& 0.8912073599322992\\ 1.5& 0.07073720179088111& 0.9974949865466858\\ 2.2& -0.5885011161042537& 0.8084964039944372\\ 2.5& -0.8011436142677193& 0.5984721447078309\end{array}\right]\right]\right)\end{array}\right]$ (8)
 > $\left[\mathrm{dsol2}\left[1,1\right]\left[1\right]=\mathrm{dsol2}\left[2,1\right]\left[6,1\right],\mathrm{dsol2}\left[1,1\right]\left[2\right]=\mathrm{dsol2}\left[2,1\right]\left[6,2\right]\right]$
 $\left[{t}{=}{2.5}{,}{x}{}\left({t}\right){=}{-0.801143614267719}\right]$ (9)

listprocedure output

 > $\mathrm{dsys3}≔\left\{\mathrm{diff}\left(x\left(t\right),\mathrm{}\left(t,3\right)\right)=x\left(t\right)+y\left(t\right),\mathrm{diff}\left(y\left(t\right),t\right)=-x\left(t\right)+y\left(t\right)\right\}$
 ${\mathrm{dsys3}}{≔}\left\{\frac{{{ⅆ}}^{{3}}}{{ⅆ}{{t}}^{{3}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{x}{}\left({t}\right){=}{x}{}\left({t}\right){+}{y}{}\left({t}\right){,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{-}{x}{}\left({t}\right){+}{y}{}\left({t}\right)\right\}$ (10)
 > $\mathrm{init3}≔\left\{x\left(0\right)=1,y\left(0\right)=1.3,\mathrm{D}\left(x\right)\left(0\right)=-1,{\mathrm{D}}^{\left(2\right)}\left(x\right)\left(0\right)=0.5\right\}$
 ${\mathrm{init3}}{≔}\left\{{x}{}\left({0}\right){=}{1}{,}{y}{}\left({0}\right){=}{1.3}{,}{\mathrm{D}}{}\left({x}\right){}\left({0}\right){=}{-1}{,}{{\mathrm{D}}}^{\left({2}\right)}{}\left({x}\right){}\left({0}\right){=}{0.5}\right\}$ (11)
 > $\mathrm{dsol3}≔\mathrm{dsolve}\left(\mathrm{dsys3}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{union}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{init3},\mathrm{numeric},\mathrm{method}=\mathrm{dverk78},\mathrm{output}=\mathrm{listprocedure},\mathrm{maxstep}=0.01\right):$
 > $\mathrm{dsol3x}≔\mathrm{subs}\left(\mathrm{dsol3},x\left(t\right)\right):$$\mathrm{dsol3y}≔\mathrm{subs}\left(\mathrm{dsol3},y\left(t\right)\right):$
 > $\left[\mathrm{dsol3x}\left(0\right),\mathrm{dsol3y}\left(0\right)\right]$
 $\left[{1.}{,}{1.3}\right]$ (12)
 > $\left[\mathrm{dsol3x}\left(1\right),\mathrm{dsol3y}\left(1\right)\right]$
 $\left[{0.623059643663728}{,}{2.30932410466714}\right]$ (13)
 > $\left[\mathrm{dsol3x}\left(1.5\right),\mathrm{dsol3y}\left(1.5\right)\right]$
 $\left[{1.36464098811480}{,}{3.23223976483577}\right]$ (14)

Comparison of use of 'interpolant' and 'pair'

 > $\mathrm{dsol4a}≔\mathrm{dsolve}\left(\left\{\mathrm{diff}\left(y\left(x\right),x,x\right)=-y\left(x\right),y\left(0\right)=0,\mathrm{D}\left(y\right)\left(0\right)=1\right\},\mathrm{numeric},\mathrm{method}=\mathrm{dverk78},\mathrm{tolerance}=1.×{10}^{-9},\mathrm{errorest}=\mathrm{interpolant}\right)$
 ${\mathrm{dsol4a}}{≔}{\mathbf{proc}}\left({\mathrm{x_dverk78}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (15)
 > $\mathrm{tt}≔\mathrm{time}\left(\right):$
 > $\mathrm{dsol4a}\left(1000\right)$
 $\left[{x}{=}{1000.}{,}{y}{}\left({x}\right){=}{0.826879438181235}{,}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){=}{0.562379146833518}\right]$ (16)
 > $\mathrm{time}\left(\right)-\mathrm{tt}$
 ${0.227}$ (17)
 > $\mathrm{dsol4b}≔\mathrm{dsolve}\left(\left\{\mathrm{diff}\left(y\left(x\right),x,x\right)=-y\left(x\right),y\left(0\right)=0,\mathrm{D}\left(y\right)\left(0\right)=1\right\},\mathrm{numeric},\mathrm{method}=\mathrm{dverk78},\mathrm{tolerance}=1.×{10}^{-9},\mathrm{errorest}=\mathrm{pair}\right)$
 ${\mathrm{dsol4b}}{≔}{\mathbf{proc}}\left({\mathrm{x_dverk78}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (18)
 > $\mathrm{tt}≔\mathrm{time}\left(\right):$
 > $\mathrm{dsol4b}\left(1000\right)$
 $\left[{x}{=}{1000.}{,}{y}{}\left({x}\right){=}{0.826879446231662}{,}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){=}{0.562379141799196}\right]$ (19)
 > $\mathrm{time}\left(\right)-\mathrm{tt}$
 ${0.129}$ (20)

References

 Enright, W.H. "The Relative Efficiency of Alternative Defect Control Schemes for High Order Continuous Runge-Kutta Formulas." Technical Report 252/91, Dept. of Computer Science, University of Toronto, June, 1991.
 Verner, J.H. "Explicit Runge-Kutta Methods with Estimates of the Local Truncation Error." SIAM Journal of Numerical Analysis, Aug. 1978.

Credits

 Much appreciation and thanks go to Dr. Jim Verner who provided us with the coefficients for the dverk78 method, and the related interpolant. Without these coefficients the method would be restricted to hardware precision.