Overview - Maple Help

dsolve/numeric

find numerical solution of ordinary differential equations

 Calling Sequence dsolve(odesys, numeric, vars, options) dsolve(numeric, procopts, options)

Parameters

 odesys - set or list; ordinary differential or differential-algebraic equation(s) and initial/boundary conditions numeric - name; instruct dsolve to find a numerical solution vars - (optional) any indeterminate function of one variable, or a set or list of them, representing the unknowns of the ODE problem procopts - (required if odesys is not present) options that specify a procedure defined system (procedure, initial, start, number, and procvars). For more information, see dsolve[numeric,IVP]. options - (optional) equations of the form keyword = value

Description

 • The dsolve command with the numeric or type=numeric option finds a numerical solution for the ODE or ODE system. If the optional equation method=numericmethod is provided (where numericmethod is one of rkf45, ck45, rosenbrock, bvp, rkf45_dae, ck45_dae, rosenbrock_dae, dverk78, lsode, gear, taylorseries, mebdfi, or classical), dsolve uses that method to obtain the numerical solution.
 Both initial and boundary value problems can be numerically solved, as well as initial differential algebraic problems. For a system input, the type of problem is automatically detected, but for some DAE problems it may be necessary to specify the method.
 By default, a procedure is returned that can be used to obtain solution values if given the value of the independent variable.
 • The default for initial value problems (IVP) is a Runge-Kutta Fehlberg method that produces a fifth order accurate solution (For more information, see rkf45 or numeric,IVP). For boundary value problems (BVP), a finite difference technique with Richardson extrapolation is used (For more information, see numeric,BVP). For differential-algebraic IVP problems (DAE), a modification of the rkf45 method is used (For more information, see DAE_extension).
 • All IVP methods can be used for complex-valued IVPs with a real-valued independent variable (though for the default stiff and nonstiff IVP methods, it may be necessary to specify that the problem is complex via the complex option). None of the BVP or DAE methods can currently be used for complex-valued problems, requiring the system be converted to a real system before calling dsolve.
 • The IVP and DAE methods have additional capabilities for the returned solution procedure. Specifically, it is possible to query the last computed solution value (useful for problems with singularities), query the initial data, and change the initial data for some solution procedures (DAE methods support a subset of this).  The IVP and DAE IVP integrators can also handle parametrized problems. For more information, see numeric,interactive as well as numeric,IVP and numeric,DAE.
 • When the set of dependent variables vars is specified as a list, then this specifies the order of the dependent variables as they appear in the output. The order is otherwise alphabetical in the dependent variable name.

Options

 • The high-level options, most common to IVPs, BVPs, and DAEs are as follows.

 'output'        = keyword or array 'stiff'         = boolean 'events'        = list 'event_pre'     = keyword 'event_maxiter' = integer 'range'         = numeric..numeric 'abserr'        = numeric or list 'relerr'        = numeric 'known'         = name or list of names 'optimize'      = boolean

 'output'= keyword or array
 Keyword that can take the values procedurelist, listprocedure, operator, or piecewise, or an array or Array that gives the values of the independent variable at which solution values are desired.
 The default keyword is procedurelist, which gives the output from dsolve as a procedure. This procedure accepts the value of the independent variable as an argument, and it returns a list of the solution values of the form variable=value, where the left-hand sides are the names of the independent variable, the dependent variable(s) and their derivatives (for higher order equations), and the right-hand sides are the corresponding computed solution values.
 The listprocedure keyword gives the output as a list of equations of the form variable=procedure, where the left-hand sides are the names of the independent variable, the dependent variable(s) and derivatives, and the right-hand sides are procedures that can be used to compute the corresponding solution components. This output form is most useful when the returned procedure is to be used later with, for example, fsolve.
 The operator keyword gives the output as a list of equations of the form operator=procedure, where the left-hand sides are operators that can be applied to an independent variable value to give the function or derivative evaluated at a point, and the right-hand sides are procedures that can be used to compute the corresponding solution components. This output form is most useful for shortcut evaluation forms where the returned list is to be evaluated at a point (for example, $\left[\mathrm{result}\right]\left(1\right)$).
 The piecewise keyword is available only for non-stiff and stiff default IVP and DAE methods (rkf45, ck45, rosenbrock, rkf45_dae, ck45_dae, and rosenbrock_dae) and the taylorseries method. It provides output as a list of equations of the form $\mathrm{variable}=\mathrm{pwfunc}$, where the left-hand sides are the names of the independent variable, the dependent variable(s) and derivatives, and the right-hand sides are piecewise polynomial functions describing the corresponding solution components. These piecewise functions are obtained from the method interpolants for each step of the computation. In addition, the form of the piecewise polynomials can be specified using an index on the piecewise output request. Specification of output=piecewise[horner] provides output in terms of horner-form polynomials (the default for taylorseries), while specification of output=piecewise[polynomial] provides output in terms of standard polynomial form (the default for all other methods). Use of this output form requires that the 'range' argument be used to specify to dsolve/numeric the desired range of the piecewise function.
 If an array is used, it must be a vector of floats that defines the values of the independent variable at which solution values are desired. When this option is given, a 2 x 1 matrix is returned (instead of a solution procedure). The $\left[1,1\right]$ entry is an array containing the name of the independent variable and the names of the dependent variable(s) and derivatives. The $\left[2,1\right]$ entry is a matrix. The first column of this matrix is a copy of the output vector, that is, the values of the independent variable. The other columns are values of the dependent variable(s) and derivatives corresponding to the vector of names in $\left[1,1\right]$. Row $i$ of this matrix is the vector containing both the value of the independent variable and the values of the dependent variables evaluated at element $i$ of the output array.
 Note: If an Array is used, then the output is the same as for an array except the newer Array and Matrix datatypes are used in the output. For a large number of output points and/or solution components, the output data may not be directly visible because there is a default size at which the representation of an Array or Matrix is displayed instead of an inline display of the data itself. For more information, see interface(rtablesize).
 'stiff'= boolean
 Boolean that is used only for IVP and DAE. Setting stiff=true without selecting a method specifies that the default stiff methods (rosenbrock or rosenbrock_dae) must be used instead of the default non-stiff methods (rkf45 or rkf45_dae). When the method is also specified, a consistency check is performed to verify that the method matches with the 'stiff' value. For more information on the phenomena of stiffness, see dsolve[Stiffness].
 'events'= list
 'event_pre'= keyword
 'event_maxiter'= integer
 Arguments that are available only for real-valued IVPs or DAEs using the non-stiff and stiff methods, rkf45, ck45, rosenbrock, rkf45_dae, ck45_dae, or rosenbrock_dae, and are used to specify and control the behavior of events. These options are discussed in detail in dsolve[Events].
 'range'= numeric...numeric
 Values that specify the range of the independent variable over which solution values are desired.
 For IVPs and DAEs this option is used only by the non-stiff and stiff methods (rkf45, ck45, rosenbrock, rkf45_dae, ck45_dae, rosenbrock_dae) and the taylorseries method. It has two purposes for procedure-type output. If 'range' is used, then the call to dsolve computes the solution over the desired range before returning, storing that solution for later calls to the returned procedure, which then compute the return values through interpolation.
 Notes:
 - When computing a numerical solution for a problem that has large regions where the solution is changing slowly, and small regions where the solution is changing rapidly, use of 'range' combined with the refine option of odeplot (rkf45, ck45, and rosenbrock only) allows better plotting of the details of the solution. If 'range' is not used, then the call to dsolve returns a procedure that does not store the computed solution, but rather computes the solution whenever a point is requested.
 - For long-time integration problems it is suggested that 'range' not be used, as the storage of the entire solution can consume a fair bit of memory.
 For the BVP method, this option is only needed when the BVP method is to be used to solve an IVP with a global error bound, as for BVP the information can be inferred from the boundary conditions in deqns. For more information, see numeric,BVP.
 'abserr'= numeric or list
 Numeric value that gives a limit on the absolute error tolerance for a successful step in the IVP and DAE cases, and a measure of the maximum error between the computed solution and the exact solution in the BVP case (in all but exceptional systems). It is supported by all methods except the classical methods (as all classical methods are implemented with a fixed step size and no error control). The list form of abserr is available for the rkf45, ck45, rosenbrock, and mebdfi IVP and DAE methods, and allows specification of absolute error tolerances that are different for each dependent variable, or for each solution component. More detail on this can be found in the dsolve[numeric,IVP] page and the dsolve[Error_Control] page.
 'relerr'= numeric
 Numeric value that gives a limit on the relative error tolerance for a successful step for an IVP or DAE. This option works in conjunction with 'abserr'. It is supported by all methods except classical, taylorseries, and bvp.
 Defaults for 'abserr' and 'relerr' are specific to each method, but it should be noted that the default error tolerance for the non-stiff methods rkf45 and ck45 is now fixed (rather than controlled by the value of Digits).
 For a detailed discussion about error control, see dsolve[Error_Control].
 'known'= name or list of names
 Provides a list of functions that should be considered as known when examining the system. This allows for specification of a system containing user-defined functions. Each user defined function must always return numerical values when given numeric input, and must return unevaluated when given name input. For an illustration of the use of this option, see the Examples section below.
 Note: In most cases, use of a system with a user-defined function prevents the use of evalhf within dsolve, so obtaining a solution using this facility will run noticeably slower than specification of the system in terms of known functions (when it is possible to express the system in this way).
 All methods except taylorseries, rosenbrock, and rosenbrock_dae support this option directly, but for these two methods additional information is required. The key problem is that these two methods require information on the derivatives of the input ODE system, which is not directly available when functions are procedure defined. It is still possible to use these methods with 'known', as long as the derivatives of the function are defined via use of one or more diff/ rules. The rosenbrock method requires only a single derivative, but the taylorseries method requires derivatives to arbitrary order, so with taylorseries it is useful only if some finite derivative of the 'known' functions can be represented as a function instead of a procedure, in which case, all derivatives up to that function derivative must have a diff rule defined. The rosenbrock_dae method may require more than a single derivative, as the DAE preprocessing may need to differentiate the input system.
 For taylorseries, rosenbrock, and rosenbrock_dae use of multiple argument functions, or functions that also depend on the dependent variables or derivatives of the problem are tricky, and have some limitations. The details of this are deferred to the respective help pages.
 'optimize'= boolean
 Boolean that tells dsolve to optimize the input system for computation. This adds an up-front cost, with the possible reward that the core computation itself will be faster. This is false by default for IVP and BVP problems, and true by default for DAE problems (which typically derive the most benefit from optimization). Systems containing conditional evaluation functions (such as piecewise) should not use optimize=true, as this will sometimes result in a slower computation. This option is available only for system defined problems, and for all methods except taylorseries (which uses its own form of optimization).
 • All other options, including options for specification of procedures for the evaluation of the ODE system, and options specific to IVP or BVP are discussed in dsolve[numeric,IVP] and dsolve[numeric,BVP], or the help pages specific to each method.

Notes

 • When Digits<=$\mathrm{evalhf}\left(\mathrm{Digits}\right)$, numerical solutions are computed in double precision (hardware floats). This is the default, as on initialization Maple sets Digits to 10. Explicit setting of Digits>$\mathrm{evalhf}\left(\mathrm{Digits}\right)$ causes dsolve to compute numerical solutions using Maple floats instead of hardware floats. The precision of a computation is fixed in the call to dsolve, so for procedure outputs, once the procedure is created, further changes to the setting of Digits should have no effect on the computed solution.
 Numerical solutions can be used in combination with fsolve, but the Digits setting on the call to fsolve must be lower (usually by 5 or more) than the precision for the dsolve procedure (because fsolve requires a higher accuracy on the residual than the current Digits setting). The rkf45, ck45, rosenbrock, and taylorseries methods, when computing solution values with an interpolant, work around this problem by computing the interpolant with the current setting of Digits when called from fsolve. An example of the problem is presented in the last example below.
 • Results can be plotted by using the odeplot function in the plots package.
 • ODE systems can also be interactively solved and plotted with the dsolve[interactive] Maplet interface.

Examples

Solve a system of ODEs

This system describes simple harmonic motion with no friction.

 > $\mathrm{dsys}≔\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),x\left(0\right)=1,y\left(0\right)=0\right\}:$
 > $\mathrm{dsn1}≔\mathrm{dsolve}\left(\mathrm{dsys},\mathrm{numeric}\right):$
 > $\mathrm{dsn1}\left(1\right)$
 $\left[{t}{=}{1.}{,}{x}{}\left({t}\right){=}{0.540302331778567}{,}{y}{}\left({t}\right){=}{-0.841471101155307}\right]$ (1)

If you specify the set of dependent variables as a list, those variables appear in the same order in the output.

 > $\mathrm{dsn2}≔\mathrm{dsolve}\left(\mathrm{dsys},\mathrm{numeric},\left[y\left(t\right),x\left(t\right)\right]\right):$
 > $\mathrm{dsn2}\left(1\right)$
 $\left[{t}{=}{1.}{,}{y}{}\left({t}\right){=}{-0.841471101155307}{,}{x}{}\left({t}\right){=}{0.540302331778567}\right]$ (2)

Straightforward second order IVP:

 > $\mathrm{deq1}≔{\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$
 ${\mathrm{deq1}}{≔}{\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}$ (3)
 > $\mathrm{ic1}≔y\left(0\right)=0.6713967071418030,\mathrm{D}\left(y\right)\left(0\right)=0.09540051444747446:$
 > $\mathrm{dsol1}≔\mathrm{dsolve}\left(\left\{\mathrm{deq1},\mathrm{ic1}\right\},\mathrm{numeric},\mathrm{range}=0..1\right)$
 ${\mathrm{dsol1}}{≔}{\mathbf{proc}}\left({\mathrm{x_rkf45}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (4)
 > $\mathrm{dsol1}\left(0\right)$
 $\left[{t}{=}{0.}{,}{y}{}\left({t}\right){=}{0.671396707141803}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{0.0954005144474745}\right]$ (5)
 > $\mathrm{dsol1}\left(0.5\right)$
 $\left[{t}{=}{0.5}{,}{y}{}\left({t}\right){=}{0.649838013736792}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{-0.170529562812705}\right]$ (6)
 > $\mathrm{dsol1}\left(1\right)$
 $\left[{t}{=}{1.}{,}{y}{}\left({t}\right){=}{0.513016090105034}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{-0.363039820324515}\right]$ (7)

Same second order IVP with operator output:

 > $\mathrm{dsol1b}≔\mathrm{dsolve}\left(\left\{\mathrm{deq1},\mathrm{ic1}\right\},\mathrm{numeric},\mathrm{output}=\mathrm{operator}\right)$
 ${\mathrm{dsol1b}}{≔}\left[{t}{=}{\mathbf{proc}}\left({t}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}{,}{y}{=}{\mathbf{proc}}\left({t}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}{,}{\mathrm{D}}{}\left({y}\right){=}{\mathbf{proc}}\left({t}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}\right]$ (8)
 > $\mathrm{dsol1b}\left(0\right)$
 $\left[{t}{=}{0.}{,}{y}{}\left({0}\right){=}{0.671396707141803}{,}{\mathrm{D}}{}\left({y}\right){}\left({0}\right){=}{0.0954005144474745}\right]$ (9)
 > $\mathrm{dsol1b}\left(0.5\right)$
 $\left[{t}{=}{0.5}{,}{y}{}\left({0.5}\right){=}{0.649838013736792}{,}{\mathrm{D}}{}\left({y}\right){}\left({0.5}\right){=}{-0.170529562812705}\right]$ (10)
 > $\mathrm{dsol1b}\left(1\right)$
 $\left[{t}{=}{1.}{,}{y}{}\left({1}\right){=}{0.513016090105034}{,}{\mathrm{D}}{}\left({y}\right){}\left({1}\right){=}{-0.363039820324514}\right]$ (11)

First order variable coefficient IVP:

 > $\mathrm{dsol2}≔\mathrm{dsolve}\left(\left\{\mathrm{diff}\left(y\left(x\right),x\right)=y\left(x\right)\mathrm{cos}\left(x\right),y\left(0\right)=1\right\},\mathrm{numeric},\mathrm{output}=\mathrm{listprocedure}\right)$
 ${\mathrm{dsol2}}{≔}\left[{x}{=}{\mathbf{proc}}\left({x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}{,}{y}{}\left({x}\right){=}{\mathbf{proc}}\left({x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}\right]$ (12)
 > $\mathrm{fy2}≔\mathrm{eval}\left(y\left(x\right),\mathrm{dsol2}\right)$
 ${\mathrm{fy2}}{≔}{\mathbf{proc}}\left({x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (13)
 > $\left[\mathrm{fy2}\left(0\right),\mathrm{fy2}\left(\frac{\mathrm{\pi }}{4}\right),\mathrm{fy2}\left(\frac{\mathrm{\pi }}{2}\right),\mathrm{fy2}\left(\frac{3\mathrm{\pi }}{2}\right),\mathrm{fy2}\left(\mathrm{\pi }\right)\right]$
 $\left[{1.}{,}{2.02811545714854}{,}{2.71828201727134}{,}{0.367879858344611}{,}{0.999999785849056}\right]$ (14)

First order IVP with piecewise output:

 > $\mathrm{dsol2p}≔\mathrm{dsolve}\left(\left\{\mathrm{diff}\left(y\left(x\right),x\right)=y\left(x\right)\mathrm{cos}\left(x\right),y\left(0\right)=1\right\},\mathrm{numeric},\mathrm{output}=\mathrm{piecewise},\mathrm{range}=0..1\right)$
 ${\mathrm{dsol2p}}{≔}\left[{x}{=}{x}{,}{y}{}\left({x}\right){=}\left\{\begin{array}{cc}{\mathrm{undefined}}& {x}{<}{0.}\\ {0.999614858592639}{+}{1.02775126621593}{}{x}{+}{0.499406940429015}{}{\left({x}{-}{0.0277621231571285}\right)}^{{2}}{-}{0.0145000342870509}{}{\left({x}{-}{0.0277621231571285}\right)}^{{3}}{-}{0.133835263967526}{}{\left({x}{-}{0.0277621231571285}\right)}^{{4}}& {x}{\le }{0.0555242463142570086}\\ {0.989101552131176}{+}{1.14719850211587}{}{x}{+}{0.481091117076617}{}{\left({x}{-}{0.149013262842108}\right)}^{{2}}{-}{0.0904918748856021}{}{\left({x}{-}{0.149013262842108}\right)}^{{3}}{-}{0.172313265589485}{}{\left({x}{-}{0.149013262842108}\right)}^{{4}}& {x}{\le }{0.242502279369958884}\\ {0.948397466098112}{+}{1.31597042278255}{}{x}{+}{0.387428683654558}{}{\left({x}{-}{0.340057388049019}\right)}^{{2}}{-}{0.244571952705452}{}{\left({x}{-}{0.340057388049019}\right)}^{{3}}{-}{0.220713724578106}{}{\left({x}{-}{0.340057388049019}\right)}^{{4}}& {x}{\le }{0.437612496728078171}\\ {0.897425216810995}{+}{1.43475629979104}{}{x}{+}{0.183288214102761}{}{\left({x}{-}{0.541367533502424}\right)}^{{2}}{-}{0.432634746442101}{}{\left({x}{-}{0.541367533502424}\right)}^{{3}}{-}{0.225886957923084}{}{\left({x}{-}{0.541367533502424}\right)}^{{4}}& {x}{\le }{0.645122570276770224}\\ {0.890827299362533}{+}{1.44839243200584}{}{x}{-}{0.133255972479318}{}{\left({x}{-}{0.743628540874630}\right)}^{{2}}{-}{0.598745668466927}{}{\left({x}{-}{0.743628540874630}\right)}^{{3}}{-}{0.155195537009859}{}{\left({x}{-}{0.743628540874630}\right)}^{{4}}& {x}{\le }{0.842134511472489633}\\ {0.981744432894418}{+}{1.34133782273687}{}{x}{-}{0.477242160985440}{}{\left({x}{-}{0.921067255736247}\right)}^{{2}}{-}{0.673533875002395}{}{\left({x}{-}{0.921067255736247}\right)}^{{3}}{-}{0.0140365582324127}{}{\left({x}{-}{0.921067255736247}\right)}^{{4}}& {x}{\le }{1.}\\ {\mathrm{undefined}}& {\mathrm{otherwise}}\end{array}\right\\right]$ (15)

Stiff first-order nonlinear problem:

 > $\mathrm{dsys3}≔\mathrm{diff}\left(x\left(t\right),t\right)={x\left(t\right)}^{2}-{t}^{6},x\left(0\right)=-0.1$
 ${\mathrm{dsys3}}{≔}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{x}{}\left({t}\right){=}{{x}{}\left({t}\right)}^{{2}}{-}{{t}}^{{6}}{,}{x}{}\left({0}\right){=}{-0.1}$ (16)
 > $\mathrm{dsol3}≔\mathrm{dsolve}\left(\left[\mathrm{dsys3}\right],\mathrm{type}=\mathrm{numeric},\mathrm{stiff}=\mathrm{true},\mathrm{output}=\mathrm{Array}\left(\left[0,0.25,0.5,0.75,1\right]\right)\right)$
 ${\mathrm{dsol3}}{≔}\left[\begin{array}{c}\left[\begin{array}{cc}{t}& {x}{}\left({t}\right)\end{array}\right]\\ \left[\begin{array}{cc}{0.}& {-0.100000000000000}\\ {0.250000000000000}& {-0.0975697047501167}\\ {0.500000000000000}& {-0.0963407325327339}\\ {0.750000000000000}& {-0.111744790112399}\\ {1.}& {-0.229279026435938}\end{array}\right]\end{array}\right]$ (17)

Second-order linear BVP:

 > $\mathrm{dsol4}≔\mathrm{dsolve}\left(\left[\mathrm{diff}\left(y\left(x\right),x,x\right)=3y\left(x\right),y\left(0\right)=1,y\left(2\right)=1.2\right],\mathrm{numeric}\right)$
 ${\mathrm{dsol4}}{≔}{\mathbf{proc}}\left({\mathrm{x_bvp}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (18)
 > $\mathrm{dsol4}\left(0\right)$
 $\left[{x}{=}{0.}{,}{y}{}\left({x}\right){=}{1.}{,}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){=}{-1.60520425463385}\right]$ (19)
 > $\mathrm{dsol4}\left(0.5\right)$
 $\left[{x}{=}{0.5}{,}{y}{}\left({x}\right){=}{0.492273627127114}{,}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){=}{-0.551072761778113}\right]$ (20)
 > $\mathrm{dsol4}\left(1\right)$
 $\left[{x}{=}{1.}{,}{y}{}\left({x}\right){=}{0.377412857949490}{,}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){=}{0.0632677085684644}\right]$ (21)
 > $\mathrm{dsol4}\left(2\right)$
 $\left[{x}{=}{2.}{,}{y}{}\left({x}\right){=}{1.20000000000000}{,}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){=}{1.97400119243652}\right]$ (22)

Second-order nonlinear BVP:

 > $\mathrm{dsys5}≔\left\{\mathrm{diff}\left(y\left(x\right),x,x\right)+\mathrm{abs}\left(y\left(x\right)\right)=0,y\left(1\right)=-1,\mathrm{D}\left(y\right)\left(0\right)=1\right\}$
 ${\mathrm{dsys5}}{≔}\left\{\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){+}\left|{y}{}\left({x}\right)\right|{=}{0}{,}{y}{}\left({1}\right){=}{-1}{,}{\mathrm{D}}{}\left({y}\right){}\left({0}\right){=}{1}\right\}$ (23)
 > $\mathrm{dsol5}≔\mathrm{dsolve}\left(\mathrm{dsys5},\mathrm{numeric},\mathrm{output}=\mathrm{Array}\left(\left[0,0.25,0.5,0.75,1\right]\right)\right)$
 ${\mathrm{dsol5}}{≔}\left[\begin{array}{c}\left[\begin{array}{ccc}{x}& {y}{}\left({x}\right)& \frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\end{array}\right]\\ \left[\begin{array}{ccc}{0.}& {-1.40964842958752}& {1.00000000000000}\\ {0.25}& {-1.20131753968156}& {0.675318544177147}\\ {0.5}& {-1.06846086551063}& {0.393064786112399}\\ {0.75}& {-1.00273152713015}& {0.135505794809610}\\ {1.}& {-1.00000000000000}& {-0.113539882361526}\end{array}\right]\end{array}\right]$ (24)

DAE system for the simple 2-D pendulum:

 > $\mathrm{dsys6}≔\left\{{x\left(t\right)}^{2}+{y\left(t\right)}^{2}=1,\mathrm{diff}\left(x\left(t\right),t,t\right)=-2\mathrm{\lambda }\left(t\right)x\left(t\right),\mathrm{diff}\left(y\left(t\right),t,t\right)=-2\mathrm{\lambda }\left(t\right)y\left(t\right)-{\mathrm{\pi }}^{2},x\left(0\right)=0,y\left(0\right)=-1,\mathrm{D}\left(x\right)\left(0\right)=\frac{1}{10},\mathrm{D}\left(y\right)\left(0\right)=0\right\}$
 ${\mathrm{dsys6}}{≔}\left\{{{x}{}\left({t}\right)}^{{2}}{+}{{y}{}\left({t}\right)}^{{2}}{=}{1}{,}\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{x}{}\left({t}\right){=}{-}{2}{}{\mathrm{\lambda }}{}\left({t}\right){}{x}{}\left({t}\right){,}\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{-}{2}{}{\mathrm{\lambda }}{}\left({t}\right){}{y}{}\left({t}\right){-}{{\mathrm{\pi }}}^{{2}}{,}{x}{}\left({0}\right){=}{0}{,}{y}{}\left({0}\right){=}{-1}{,}{\mathrm{D}}{}\left({x}\right){}\left({0}\right){=}\frac{{1}}{{10}}{,}{\mathrm{D}}{}\left({y}\right){}\left({0}\right){=}{0}\right\}$ (25)
 > $\mathrm{dsol6}≔\mathrm{dsolve}\left(\mathrm{dsys6},\mathrm{numeric}\right)$
 ${\mathrm{dsol6}}{≔}{\mathbf{proc}}\left({\mathrm{x_rkf45_dae}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (26)
 > $\mathrm{dsol6}\left(1\right)$
 $\left[{t}{=}{1.}{,}{\mathrm{\lambda }}{}\left({t}\right){=}{4.93980221499583}{,}{x}{}\left({t}\right){=}{6.33398801850387}{×}{{10}}^{{-6}}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{x}{}\left({t}\right){=}{-0.100000139089421}{,}{y}{}\left({t}\right){=}{-0.999999999836514}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({t}\right){=}{-6.24735803827156}{×}{{10}}^{{-7}}\right]$ (27)

Example of use with fsolve:

 > $\mathrm{dsys7}≔\left\{\mathrm{diff}\left(y\left(x\right),x\right)=2y\left(x\right),y\left(0\right)=1\right\}$
 ${\mathrm{dsys7}}{≔}\left\{\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){=}{2}{}{y}{}\left({x}\right){,}{y}{}\left({0}\right){=}{1}\right\}$ (28)
 > $\mathrm{Digits}≔20$
 ${\mathrm{Digits}}{≔}{20}$ (29)
 > $\mathrm{dsol7}≔\mathrm{dsolve}\left(\mathrm{dsys7},\mathrm{numeric},\mathrm{method}=\mathrm{gear},\mathrm{abserr}=1.×{10}^{-16},\mathrm{relerr}=1.×{10}^{-16},\mathrm{output}=\mathrm{listprocedure}\right)$
 ${\mathrm{dsol7}}{≔}\left[{x}{=}{\mathbf{proc}}\left({x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}{,}{y}{}\left({x}\right){=}{\mathbf{proc}}\left({x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}\right]$ (30)
 > $\mathrm{yproc}≔\mathrm{rhs}\left(\mathrm{dsol7}\left[2\right]\right)$
 ${\mathrm{yproc}}{≔}{\mathbf{proc}}\left({x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (31)

Attempt with same Digits setting, returns unevaluated.

 > fsolve(yproc(x)=1e5, x=4..7);
 ${\mathrm{fsolve}}{}\left({\mathrm{yproc}}{}\left({x}\right){=}{100000.}{,}{x}{,}{4}{..}{7}\right)$ (32)

The same command with Digits set to 15 succeeds.

 > $\mathrm{Digits}≔15$
 ${\mathrm{Digits}}{≔}{15}$ (33)
 > fsolve(yproc(x)=1e5, x=4..7);
 ${5.75646273248511}$ (34)
 > $\mathrm{Digits}≔10$
 ${\mathrm{Digits}}{≔}{10}$ (35)

Use of known option:

 > f := proc(x) local t;    if not type(evalf(x),'numeric') then       'procname'(x);    else       evalf(Int(exp(-t^2/10),t=0..x));    end if; end proc;
 ${f}{≔}{\mathbf{proc}}\left({x}\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}}{\mathrm{type}}{}\left({\mathrm{evalf}}{}\left({x}\right){,}{'}{\mathrm{numeric}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{'}{\mathrm{procname}}{'}{}\left({x}\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({\mathrm{exp}}{}\left({−}{1}{/}{10}{*}{t}{^}{2}\right){,}{t}{=}{0}{..}{x}\right)\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (36)

Note that the procedure is set up for an unevaluated return if the input is not numeric.

 > $\mathrm{dsys8}≔\left\{\mathrm{diff}\left(y\left(x\right),x\right)=y\left(x\right)+f\left(x\right),y\left(0\right)=0\right\}$
 ${\mathrm{dsys8}}{≔}\left\{\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){=}{y}{}\left({x}\right){+}{f}{}\left({x}\right){,}{y}{}\left({0}\right){=}{0}\right\}$ (37)
 > $\mathrm{dsolve}\left(\mathrm{dsys8},\mathrm{numeric}\right)$

This failed because 'known' was not specified. Here, it is specified.

 > $\mathrm{dsol8}≔\mathrm{dsolve}\left(\mathrm{dsys8},\mathrm{numeric},\mathrm{known}=f\right)$
 ${\mathrm{dsol8}}{≔}{\mathbf{proc}}\left({\mathrm{x_rkf45}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (38)
 > $\mathrm{dsol8}\left(1\right)$
 $\left[{x}{=}{1.}{,}{y}{}\left({x}\right){=}{0.708149294799617}\right]$ (39)
 > $\mathrm{dsol8}\left(2\right)$
 $\left[{x}{=}{2.}{,}{y}{}\left({x}\right){=}{4.19167993111610}\right]$ (40)

A method that requires derivatives,

 > $\mathrm{dsolve}\left(\mathrm{dsys8},\mathrm{numeric},\mathrm{method}=\mathrm{rosenbrock},\mathrm{known}=f\right)$

which failed because a differentiation rule is required. We then clear the remember table of diff and define this as:

 > $\mathrm{forget}\left(\mathrm{diff}\right)$
 > diff/f := proc()     # Chain rule     diff(args[1],args[2])*exp(-(args[1])^2/10); end proc:

which works as follows:

 > $\mathrm{diff}\left(f\left(\mathrm{sin}\left(x\right)\right),x\right)$
 ${\mathrm{cos}}{}\left({x}\right){}{{ⅇ}}^{{-}\frac{{{\mathrm{sin}}{}\left({x}\right)}^{{2}}}{{10}}}$ (41)
 > $\mathrm{diff}\left(\mathrm{Int}\left(\mathrm{exp}\left(-\frac{{t}^{2}}{10}\right),t=0..\mathrm{sin}\left(x\right)\right),x\right)$
 ${\mathrm{cos}}{}\left({x}\right){}{{ⅇ}}^{{-}\frac{{{\mathrm{sin}}{}\left({x}\right)}^{{2}}}{{10}}}$ (42)

and now:

 > $\mathrm{dsol8b}≔\mathrm{dsolve}\left(\mathrm{dsys8},\mathrm{numeric},\mathrm{method}=\mathrm{rosenbrock},\mathrm{known}=f\right)$
 ${\mathrm{dsol8b}}{≔}{\mathbf{proc}}\left({\mathrm{x_rosenbrock}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (43)
 > $\mathrm{dsol8b}\left(1\right)$
 $\left[{x}{=}{1.}{,}{y}{}\left({x}\right){=}{0.708149269188472}\right]$ (44)
 > $\mathrm{dsol8b}\left(2\right)$
 $\left[{x}{=}{2.}{,}{y}{}\left({x}\right){=}{4.19168036703643}\right]$ (45)

References

 Ascher, U.; Mattheij, R.; and Russell, R. "Numerical Solution of Boundary Value Problems for Ordinary Differential Equations." SIAM Classics in Applied Mathematics. Vol. 13. (1995).
 Ascher, U., and Petzold, L. "Computer Methods for Ordinary Differential Equations and Differential-Algebraic Equations." SIAM, Philadelphia. 1998.
 Bailey, P.B.; Shampine, L.F.; and Waltman, P.E. Nonlinear Two Point Boundary Value Problems. New York: Academic Press, 1968.
 Boyce, W.E., and DiPrima, R.C. Elementary Differential Equations and Boundary Value Problems. New York: John Wiley & Sons, 1997.
 Cash, J.R. "The Integration of Stiff IVP in ODE Using Modified Extended BDF." Computers and Mathematics with Applications. Vol. 9. (1983): 645-657.
 Gear, C.W. Numerical Initial Value Problems in Ordinary Differential Equations. Prentice-Hall, 1971.
 Hindmarsh, Alan C.; Stepleman, R.S.; et al, eds. Odepack, a Systemized Collection of ODE Solvers. Amsterdam: North-Holland, 1983.
 Hubbard J.H., and West, B.H. Differential Equations: A Dynamical Systems Approach. New York: Springer, 1990. Part I. One Dimensional Equations.
 Hull, T.E.;  Enright, W.H.; Fellen, B.M.; and Sedgwick, A.E. "Comparing Numerical Methods for Ordinary Differential Equations." SIAM J. Numer. Anal. Vol. 9. (1972): 603-637.
 Shampine, L.F., and Corless, R.M. "Initial Value Problems for ODEs in Problem Solving Environments." J. Comp. Appl. Math. Vol. 125(1-2). (2000): 31-40.