 taylorseries - Maple Help

dsolve/numeric/taylorseries

numerical solution of ordinary differential equations Calling Sequence dsolve($\mathrm{odesys}$, numeric, method=taylorseries) dsolve($\mathrm{odesys}$, numeric, method=taylorseries[choice], vars, options) Parameters

 odesys - set or list; ordinary differential equation(s) and initial conditions numeric - literal name; instruct dsolve to find a numerical solution method=taylorseries - literal equation; numerical method to use choice - 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 Description

 • 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:

 'output' = keyword or array 'known' = name or list of names 'startinit' = boolean 'abserr' = numeric 'minstep' = numeric 'order' = integer 'range' = l..r 'storage' = boolean 'steppast' = boolean

 'output'
 Specifies the desired output from dsolve .
 'known'
 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.
 'startinit'
 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.
 'abserr'
 A positive floating-point number that controls the absolute error for any individual step. The default value is Float(1,-Digits).
 'minstep'
 A floating-point number that gives the minimum step size be used. The default value is $0.00001$.
 'order'
 Specifies the order of taylor series expansion used in the integration. The default value is given by max(22,trunc(3*Digits/2)).
 'range'
 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.
 'storage'
 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.
 'steppast'
 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. Examples

'listprocedure' output

 > $\mathrm{Digits}≔20:$
 > $\mathrm{dsys1}≔\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)+y\left(t\right),x\left(0\right)=2,y\left(0\right)=1\right\}$
 ${\mathrm{dsys1}}{≔}\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){+}{y}{}\left({t}\right){,}{x}{}\left({0}\right){=}{2}{,}{y}{}\left({0}\right){=}{1}\right\}$ (1)
 > $\mathrm{dsol1}≔\mathrm{dsolve}\left(\mathrm{dsys1},\mathrm{numeric},\mathrm{method}=\mathrm{taylorseries},\mathrm{output}=\mathrm{listprocedure},\mathrm{abserr}=\mathrm{Float}\left(1,-20\right)\right):$
 > $\mathrm{dsol1x}≔\mathrm{eval}\left(x\left(t\right),\mathrm{dsol1}\right):$$\mathrm{dsol1y}≔\mathrm{eval}\left(y\left(t\right),\mathrm{dsol1}\right):$
 > $\mathrm{dsol1x}\left(0\right),\mathrm{dsol1y}\left(0\right)$
 ${2.}{,}{1.}$ (2)
 > $\mathrm{dsol1x}\left(0.4\right),\mathrm{dsol1y}\left(0.4\right)$
 ${2.6911846499155574031}{,}{2.6081175867723888825}$ (3)
 > $\mathrm{dsol1x}\left(1.0\right),\mathrm{dsol1y}\left(1.0\right)$
 ${5.5821687260840732723}{,}{7.8268911966878259776}$ (4)

'array' output

 > $\mathrm{dsola1}≔\mathrm{dsolve}\left(\mathrm{dsys1},\mathrm{numeric},\mathrm{method}=\mathrm{taylorseries},\mathrm{output}=\mathrm{Array}\left(\left[0,0.2,0.4,0.6,0.8,1\right]\right),\mathrm{abserr}=\mathrm{Float}\left(1,-20\right)\right)$
 ${\mathrm{dsola1}}{≔}\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.& 2.& 1.\\ 0.2& 2.2658310100790608323& 1.6901173688142509050\\ 0.4& 2.6911846499155574031& 2.6081175867723888825\\ 0.6& 3.3302773883920226684& 3.8452396901573094253\\ 0.8& 4.2588254246585806230& 5.5271013170553894643\\ 1.& 5.5821687260840732723& 7.8268911966878259776\end{array}\right]\right]\right)\end{array}\right]$ (5)

'procedurelist' output (the default)

 > $\mathrm{dsys2}≔\left\{{\mathrm{D}}^{\left(2\right)}\left(x\right)\left(t\right)=-y\left(t\right),{\mathrm{D}}^{\left(2\right)}\left(y\right)\left(t\right)=\mathrm{D}\left(x\right)\left(t\right)+y\left(t\right)\right\}$
 ${\mathrm{dsys2}}{≔}\left\{{{\mathrm{D}}}^{\left({2}\right)}{}\left({x}\right){}\left({t}\right){=}{-}{y}{}\left({t}\right){,}{{\mathrm{D}}}^{\left({2}\right)}{}\left({y}\right){}\left({t}\right){=}{\mathrm{D}}{}\left({x}\right){}\left({t}\right){+}{y}{}\left({t}\right)\right\}$ (6)
 > $\mathrm{init2}≔\left\{x\left(0\right)=1,y\left(0\right)=0,\mathrm{D}\left(x\right)\left(0\right)=0,\mathrm{D}\left(y\right)\left(0\right)=1\right\}$
 ${\mathrm{init2}}{≔}\left\{{x}{}\left({0}\right){=}{1}{,}{y}{}\left({0}\right){=}{0}{,}{\mathrm{D}}{}\left({x}\right){}\left({0}\right){=}{0}{,}{\mathrm{D}}{}\left({y}\right){}\left({0}\right){=}{1}\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{taylorseries},\mathrm{output}=\mathrm{Array}\left(\left[0,0.6,1.1,1.5,2.3,2.5\right]\right),\mathrm{abserr}=\mathrm{Float}\left(1,-20\right)\right):$
 > $\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[5\right]=\mathrm{dsol2}\left[2,1\right]\left[6,5\right]$
 ${t}{=}{2.5}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{1.9487171722808526958}$ (8)
 > $\mathrm{Digits}≔30:$
 > $\mathrm{deqn3}≔\left\{\mathrm{diff}\left(y\left(t\right),\mathrm{}\left(t,3\right)\right)-2\mathrm{diff}\left(y\left(t\right),\mathrm{}\left(t,2\right)\right)+2y\left(t\right)\right\}$
 ${\mathrm{deqn3}}{≔}\left\{\frac{{{ⅆ}}^{{3}}}{{ⅆ}{{t}}^{{3}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){-}{2}{}\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){+}{2}{}{y}{}\left({t}\right)\right\}$ (9)
 > $\mathrm{init3}≔\left\{y\left(0\right)=1,\mathrm{D}\left(y\right)\left(0\right)=1,{\mathrm{D}}^{\left(2\right)}\left(y\right)\left(0\right)=1\right\}$
 ${\mathrm{init3}}{≔}\left\{{y}{}\left({0}\right){=}{1}{,}{\mathrm{D}}{}\left({y}\right){}\left({0}\right){=}{1}{,}{{\mathrm{D}}}^{\left({2}\right)}{}\left({y}\right){}\left({0}\right){=}{1}\right\}$ (10)
 > $\mathrm{dsol3}≔\mathrm{dsolve}\left(\mathrm{deqn3}\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{taylorseries},\mathrm{abserr}=\mathrm{Float}\left(1,-30\right)\right):$
 > $\mathrm{dsol3}\left(0.5\right)$
 $\left[{t}{=}{0.5}{,}{y}{}\left({t}\right){=}{1.61793485679327790141188491578}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{1.43910267665026980485200277955}{,}\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{0.587882166803234441848359099341}\right]$ (11)

Using storage via 'range'

 > $\mathrm{Digits}≔20:$
 > $\mathrm{dsys4}≔\left\{\mathrm{diff}\left(y\left(t\right),t,t\right)+y\left(t\right),y\left(0\right)=0,\mathrm{D}\left(y\right)\left(0\right)=1\right\}$
 ${\mathrm{dsys4}}{≔}\left\{\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){+}{y}{}\left({t}\right){,}{y}{}\left({0}\right){=}{0}{,}{\mathrm{D}}{}\left({y}\right){}\left({0}\right){=}{1}\right\}$ (12)
 > $\mathrm{dsol4}≔\mathrm{dsolve}\left(\mathrm{dsys4},\mathrm{numeric},\mathrm{method}=\mathrm{taylorseries},\mathrm{abserr}=\mathrm{Float}\left(1,-20\right),\mathrm{range}=0..10\mathrm{\pi }\right)$
 ${\mathrm{dsol4}}{≔}{\mathbf{proc}}\left({\mathrm{x_taylorseries}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (13)

Can now randomly access values in the specified range (for example, using fsolve) without cost of re-integrating:

 > $\mathrm{fsolve}\left(t↦\mathrm{rhs}\left(\mathrm{dsol4}\left(t\right)\left[2\right]\right),3..4\right)$
 ${3.1415926535897932385}$ (14)
 > $-\mathrm{evalf}\left(\mathrm{\pi }\right)$
 ${0.}$ (15)
 > $\mathrm{fsolve}\left(t↦\mathrm{rhs}\left(\mathrm{dsol4}\left(t\right)\left[2\right]\right),6..7\right)$
 ${6.2831853071795864769}$ (16)
 > $\mathrm{fsolve}\left(t↦\mathrm{rhs}\left(\mathrm{dsol4}\left(t\right)\left[2\right]\right),9..10\right)$
 ${9.4247779607693797154}$ (17)
 > $\mathrm{fsolve}\left(t↦\mathrm{rhs}\left(\mathrm{dsol4}\left(t\right)\left[2\right]\right),26..30\right)$
 ${28.274333882308139146}$ (18)

Example of dense output with/without 'steppast'

 > $\mathrm{dsol5a}≔\mathrm{dsolve}\left(\mathrm{dsys4},\mathrm{numeric},\mathrm{method}=\mathrm{taylorseries},\mathrm{abserr}=\mathrm{Float}\left(1,-20\right)\right)$
 ${\mathrm{dsol5a}}{≔}{\mathbf{proc}}\left({\mathrm{x_taylorseries}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (19)
 > $\mathrm{tt}≔\mathrm{time}\left(\right):$
 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}100\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{dsol5a}\left(\frac{\mathrm{\pi }i}{100}\right)\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}:$
 > $\mathrm{time}\left(\right)-\mathrm{tt}$
 ${0.032}$ (20)
 > $\mathrm{dsol5b}≔\mathrm{dsolve}\left(\mathrm{dsys4},\mathrm{numeric},\mathrm{method}=\mathrm{taylorseries},\mathrm{abserr}=\mathrm{Float}\left(1,-20\right),\mathrm{steppast}=\mathrm{false}\right)$
 ${\mathrm{dsol5b}}{≔}{\mathbf{proc}}\left({\mathrm{x_taylorseries}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (21)
 > $\mathrm{tt}≔\mathrm{time}\left(\right):$
 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}100\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{dsol5b}\left(\frac{\mathrm{\pi }i}{100}\right)\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{do}:$
 > $\mathrm{time}\left(\right)-\mathrm{tt}$
 ${0.115}$ (22)

Comparison of 'lazyseries' and 'series' options:

 > $\mathrm{dsys6}≔\left\{{\left(t+1\right)}^{2}\mathrm{diff}\left(y\left(t\right),t,t\right)+\left(t+1\right)\mathrm{diff}\left(y\left(t\right),t\right)+\left({\left(t+1\right)}^{2}-0.25\right)y\left(t\right)=0,y\left(0\right)=0.6713967071418030,\mathrm{D}\left(y\right)\left(0\right)=0.09540051444747446\right\}$
 ${\mathrm{dsys6}}{≔}\left\{{\left({t}{+}{1}\right)}^{{2}}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right)\right){+}\left({t}{+}{1}\right){}\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right)\right){+}\left({\left({t}{+}{1}\right)}^{{2}}{-}{0.25}\right){}{y}{}\left({t}\right){=}{0}{,}{y}{}\left({0}\right){=}{0.6713967071418030}{,}{\mathrm{D}}{}\left({y}\right){}\left({0}\right){=}{0.09540051444747446}\right\}$ (23)
 > $\mathrm{ds1}≔\mathrm{dsolve}\left(\mathrm{dsys6},\mathrm{numeric},\mathrm{method}=\mathrm{taylorseries}\left['\mathrm{series}'\right],\mathrm{abserr}=\mathrm{Float}\left(1,-20\right)\right)$
 ${\mathrm{ds1}}{≔}{\mathbf{proc}}\left({\mathrm{x_taylorseries}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (24)
 > $\mathrm{tt}≔\mathrm{time}\left(\right):$
 > $\mathrm{ds1}\left(3.0\right)$
 $\left[{t}{=}{3.0}{,}{y}{}\left({t}\right){=}{-0.30192051329163941472}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{-0.22302601251572382302}\right]$ (25)
 > $\mathrm{time}\left(\right)-\mathrm{tt}$
 ${0.326}$ (26)
 > $\mathrm{ds1}≔\mathrm{dsolve}\left(\mathrm{dsys6},\mathrm{numeric},\mathrm{method}=\mathrm{taylorseries}\left[\mathrm{lazyseries}\right],\mathrm{abserr}=\mathrm{Float}\left(1,-20\right)\right)$
 ${\mathrm{ds1}}{≔}{\mathbf{proc}}\left({\mathrm{x_taylorseries}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (27)
 > $\mathrm{tt}≔\mathrm{time}\left(\right):$
 > $\mathrm{ds1}\left(3.0\right)$
 $\left[{t}{=}{3.0}{,}{y}{}\left({t}\right){=}{-0.30192051329163941472}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{-0.22302601251572382302}\right]$ (28)
 > $\mathrm{time}\left(\right)-\mathrm{tt}$
 ${0.021}$ (29)

Use of the 'known' option for multiple argument functions (requires diff rule). Given the function

 > $f\left(x,y\left(x\right)\right)=\mathrm{Int}\left(\frac{\mathrm{exp}\left(-\frac{t\cdot 2}{100}\right)}{10},t=0..x\right)-y\left(x\right)$
 ${f}{}\left({x}{,}{y}{}\left({x}\right)\right){=}{{\int }}_{{0}}^{{x}}\frac{{{ⅇ}}^{{-}\frac{{t}}{{50}}}}{{10}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{t}{-}{y}{}\left({x}\right)$ (30)

define 'f' as

 > f := proc(x,y) local t;    if not type(evalf(x),'numeric') or       not type(evalf(y),'numeric') then       'procname'(x,y);    else       evalf(Int(exp(-t*2/100)/10,t=0..x))-y;    end if; end proc;
 ${f}{≔}{\mathbf{proc}}\left({x}{,}{y}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{local}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{t}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{not}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\left({\mathrm{type}}{}\left({\mathrm{evalf}}{}\left({x}\right){,}{'}{\mathrm{numeric}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{type}}{}\left({\mathrm{evalf}}{}\left({y}\right){,}{'}{\mathrm{numeric}}{'}\right)\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{'}{\mathrm{procname}}{'}{}\left({x}{,}{y}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{else}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{evalf}}{}\left({\mathrm{Int}}{}\left({1}{/}{10}{*}{\mathrm{exp}}{}\left({−}{1}{/}{50}{*}{t}\right){,}{t}{=}{0}{..}{x}\right)\right){-}{y}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (31)

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       diff(x,args)*exp(-x*2/100)/10-f(x,y);    elif args=y then       error "should not happen";    else       error "unable to differentiate";    end if; end proc;
 ${\mathrm{diff/f}}{≔}{\mathbf{proc}}\left({x}{,}{y}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{args}}{[}{3}{]}{=}{x}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{1}{/}{10}{*}\left({\mathrm{diff}}{}\left({x}{,}{\mathrm{args}}{[}{3}{]}\right)\right){*}{\mathrm{exp}}{}\left({−}{1}{/}{50}{*}{x}\right){-}{f}{}\left({x}{,}{y}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{elif}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{args}}{[}{3}{]}{=}{y}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{error}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{"should not happen"}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{else}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{error}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{"unable to differentiate"}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (32)

Using this information you can now call dsolve to obtain a solution procedure, then obtain solution values.

 > $\mathrm{dsol}≔\mathrm{dsolve}\left(\left\{\mathrm{diff}\left(y\left(x\right),x\right)=f\left(x,y\left(x\right)\right),y\left(0\right)=0\right\},\mathrm{numeric},\mathrm{known}=f,\mathrm{method}=\mathrm{taylorseries}\right)$
 ${\mathrm{dsol}}{≔}{\mathbf{proc}}\left({\mathrm{x_taylorseries}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (33)
 > $\mathrm{dsol}\left(10\right)$
 $\left[{x}{=}{10.}{,}{y}{}\left({x}\right){=}{0.82280691286027374071}\right]$ (34) References

 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 .