numerical solution of ordinary differential equations
dsolve(odesys, numeric, method=taylorseries)
dsolve(odesys, numeric, method=taylorseries[choice], vars, options)
set or list; ordinary differential equation(s) and initial conditions
literal name; instruct dsolve to find a numerical solution
literal equation; numerical method to use
submethod to use
(optional) dependent variable or a set or list of dependent variables for odesys
(optional) equations of the form keyword = value
The dsolve command with options numeric and method=taylorseries finds a numerical solution to the differential equations, using a Taylor series method. This method can be used for high accuracy solutions.
Note: This method usually takes more time than other methods for low accuracy results. Therefore, it is better to use this method only when a high accuracy solution is desired.
There are two choices for the submethod. The lazyseries choice specifies that dsolve should construct a routine to generate the taylor series coefficients using lazy series expansion prior to any integration. This is the default, and generally the most efficient method. The series choice specifies that at each integration step dsolve,series be called to compute a local series expansion.
The following options are available for the taylorseries method:
keyword or array
name or list of names
Specifies the desired output from dsolve .
Specifies user-defined known functions. Basic usage is discussed in dsolve[numeric]. As mentioned there, in addition to the requirement of a procedural definition for the function that evaluates with numeric arguments, this method also requires `diff/` rules.
This `diff/` rule must provide the total derivative of the function with respect to the independent variable. Note: The key word here is total, and an example can be found below. This is in contrast to the rosenbrock method, for which the diff rule must provide partial derivatives.
An arbitrary number of total derivatives are required, which means that if the derivative of a known function is provided in terms of another user-defined function, then that function must also have a `diff/` rule for computation of the total derivative with respect to independent variable. If again, this new user-defined function provides the total derivative in terms of another user-defined function, then it must also have a `diff/` rule for computation of the total derivative with respect to independent variable, ad nauseum.
The final requirement is that the 'known' option can only be used for the default taylorseries choice, namely lazyseries.
Indicates whether successive computations should use continuation from a previously computed result, or start from the initial condition for every requested solution value.
Note: The continuation is so that the direction of integration is never reversed, relative to the initial condition.
A positive floating-point number that controls the absolute error for any individual step. The default value is Float(1,-Digits).
A floating-point number that gives the minimum step size be used. The default value is 0.00001.
Specifies the order of taylor series expansion used in the integration. The default value is given by max(22,trunc(3*Digits/2)).
Specifies a range over which the solution is precomputed and stored. With this option, all returned solution values are computed from one of the stored taylor series expansions - one stored for each step of the method. Use of this option has the effect of turning storage on.
Causes the method to store the solution for all computed steps, and use the taylor polynomial over any regions where a solution has previously been computed and stored. By default this is false.
Causes the method to use the natural step size (that is, the step size proscribed by the error control) when integrating the solution, even if that natural step size would place the independent variable value (internally) past the requested point. The solution is then computed from the taylor polynomial spanning the region containing the requested point. This is more efficient for dense output, and continuation of the solution past the requested point. By default this is true.
Results can be plotted using the odeplot function in the plots package.
Digits ≔ 20:
dsys1 ≔ ⅆⅆt⁢x⁡t=y⁡t,ⅆⅆt⁢y⁡t=x⁡t+y⁡t,x⁡0=2,y⁡0=1
dsol1 ≔ dsolve⁡dsys1,numeric,method=taylorseries,output=listprocedure,abserr=1.⁢10-20:
dsol1x ≔ eval⁡x⁡t,dsol1:dsol1y ≔ eval⁡y⁡t,dsol1:
dsola1 ≔ dsolve⁡dsys1,numeric,method=taylorseries,output=Array⁡0,0.2,0.4,0.6,0.8,1,abserr=1.⁢10-20
'procedurelist' output (the default)
dsys2 ≔ D2⁡x⁡t=−y⁡t,D2⁡y⁡t=D⁡x⁡t+y⁡t
init2 ≔ x⁡0=1,D⁡x⁡0=0,y⁡0=0,D⁡y⁡0=1
dsol2 ≔ dsolve⁡dsys2∪init2,numeric,method=taylorseries,output=Array⁡0,0.6,1.1,1.5,2.3,2.5,abserr=1.⁢10-20:
Digits ≔ 30:
deqn3 ≔ ⅆ3ⅆt3⁢y⁡t−2⁢ⅆ2ⅆt2⁢y⁡t+2⁢y⁡t
init3 ≔ y⁡0=1,D⁡y⁡0=1,D2⁡y⁡0=1
dsol3 ≔ dsolve⁡deqn3∪init3,numeric,method=taylorseries,abserr=1.⁢10-30:
Using storage via 'range'
dsys4 ≔ ⅆ2ⅆt2⁢y⁡t+y⁡t,y⁡0=0,D⁡y⁡0=1
dsol4 ≔ dsolve⁡dsys4,numeric,method=taylorseries,abserr=1.⁢10-20,range=0..10⁢Pi
Can now randomly access values in the specified range (for example, using fsolve) without cost of re-integrating:
Example of dense output with/without 'steppast'
dsol5a ≔ dsolve⁡dsys4,numeric,method=taylorseries,abserr=1.⁢10-20
tt ≔ time⁡:
dsol5b ≔ dsolve⁡dsys4,numeric,method=taylorseries,abserr=1.⁢10-20,steppast=false
Comparison of 'lazyseries' and 'series' options:
dsys6 ≔ t+12⁢ⅆ2ⅆt2⁢y⁡t+t+1⁢ⅆⅆt⁢y⁡t+t+12−0.25⁢y⁡t=0,y⁡0=0.6713967071418030,D⁡y⁡0=0.09540051444747446
ds1 ≔ dsolve⁡dsys6,numeric,method=taylorseries'series',abserr=1.⁢10-20
ds1 ≔ dsolve⁡dsys6,numeric,method=taylorserieslazyseries,abserr=1.⁢10-20
Use of the 'known' option for multiple argument functions (requires diff rule). Given the function
define 'f' as
f := proc(x,y) local t;
if not type(evalf(x),'numeric') or
not type(evalf(y),'numeric') then
f:=procx,ylocalt;ifnottype⁡evalf⁡x,'numeric'andtype⁡evalf⁡y,'numeric'then'procname'⁡x,yelseevalf⁡Int⁡1/10*exp⁡−1/50*t,t=0..x − yend ifend proc
Also, use a `diff/` rule for the total derivative with respect to x. Note that the diff rule provides the total derivative in terms of Maple known functions, and the original f(x,y), for which a `diff/` rule is already defined.
`diff/f` := proc(x,y);
if args=x then
elif args=y then
error "should not happen";
error "unable to differentiate";
diff/f:=procx,yifargs=xthen1/10*diff⁡x,args*exp⁡−1/50*x − f⁡x,yelifargs=ythenerrorshould not happenelseerrorunable to differentiateend ifend proc
Using this information you can now call dsolve to obtain a solution procedure, then obtain solution values.
dsol ≔ dsolve⁡ⅆⅆx⁢y⁡x=f⁡x,y⁡x,y⁡0=0,numeric,known=f,method=taylorseries
Barton, D.; Willers, I.M.; and Zahar, R.V.M. Mathematical Software, pp. 369-389. Edited by J.R. Rice. New York: Academic Press, 1972 .
Download Help Document
What kind of issue would you like to report? (Optional)