find numerical solution of ODE initial value problems
dsolve(odesys, numeric, vars, options)
dsolve(numeric, procopts, options)
set or list; ordinary differential equation(s) and initial conditions
name; instruct dsolve to find a numerical solution
(optional) any indeterminate function of one variable, or a set or list of them, representing the unknowns of the ODE problem
(required if odesys is not present) options that specify a procedure-defined system (procedure, initial, start, number, and procvars). For more information, see below.
(optional) equations of the form keyword = value
The dsolve command with the numeric or type=numeric option and an initial value problem (IVP) finds a numerical solution for the ODE or ODE system IVP. If the optional equation method=numericmethod is provided (where numericmethod is one of rkf45, ck45, rosenbrock, dverk78, lsode, gear, taylorseries, or classical), dsolve uses that method to obtain the numerical solution.
The return value of dsolve and the following high level or common options are discussed in dsolve[numeric] and dsolve[Error_Control].
keyword or array
numeric or list
name or list of names
The exception is the list input form for abserr which requires the discussion below on conversion to first order to understand fully.
In most cases it is sufficient to specify a single value for abserr for all solution components. The exception to this is when some dependent variables for derivatives of the system have values on a different scale than other variables of the system. When this occurs, the list input form for abserr can be used to specify a different absolute error tolerance for each dependent variable of the system, or each solution component of the system (the difference between these is that specification of a tolerance for a dependent variable of the system also does so for derivatives of that variable, while for solution components each value is considered independently.
In order to specify dependent or component abserr, the order of the dependent variables in the output must be known. This can be controlled by specifying the dependent variables of the problem (the vars parameter to dsolve) as a list.
From this, dependent variable abserr is easy to understand as there is a 1-1 correspondence between the specified variables and the specified abserr.
The per-component abserr is a little trickier as the basic idea is the same, but depending on the order of each variable more than one abserr value may be required.
For example, for a problem containing x''⁢,y'''⁢,z', if the variables were specified as x⁡t,y⁡t,z⁡t, then for per-component abserr six values would be required, and would correspond to [x⁡t,x'⁡t,y⁡t,y'⁡t,y''⁡t,z⁡t].
Only the rkf45, ck45, and rosenbrock IVP methods support the list form for abserr.
The default IVP method is a Runge-Kutta Fehlberg method, which produces a solution accurate to fifth order. Another non-stiff IVP method is a Runge-Kutta method with the Cash-Karp coefficients. The default stiff method is a Rosenbrock method, which produces a solution accurate to fourth order. See dsolve[rkf45], dsolve[ck45], and dsolve[rosenbrock] for more detail on these methods. The other available methods for IVP are dsolve[dverk78], dsolve[lsode], dsolve[taylorseries], dsolve[gear], and dsolve[classical].
All IVP methods, with the exception of taylorseries, can work with a complex-valued IVP with a real-valued independent variable.
The following options are specific to IVP, and are concerned with specification of the input system in procedure form (procopts):
and the following options, also specific to IVP (and in some cases DAE), allow control of the solution method and step size, and the use of parameters in the system:
list of names
Before discussion of the procedure-based options, the Maple treatment of the numerical handling of ODE system IVPs is described. To begin with, all systems are converted to first order systems by the introduction of new dependent variables. For example, if the single ODE
were to be numerically solved, the new dependent variables u=y', v=y'' would be introduced, and the single third order ODE would become a system of three first order ODEs in three dependent variables. In addition, the derivatives of the first order system are isolated. The result would be
and the initial conditions would transform in the same way.
Now that the ODE is converted to a first order system, it is possible to describe the procedure-based options more precisely. In all that follows, any reference to the system or dependent variables refers only to the first order system.
The number of dependent variables in the first order system.
Procedure for the evaluation of the derivatives of the dependent variables. It must be of the form proc⁡N,x,Y,YP, where N is the number of dependent variables, x is the value of the independent variable at which the derivatives are to be evaluated, Y is an array of the dependent variable values at x, and YP is an output array into which the procedure places the computed values of the derivatives.
For the above example, given that the correspondence of the variables is Y1=y,Y2=u, and Y3=v, the following procedure correctly evaluates the derivatives of the ODE system.
solproc := proc(N, x, Y, YP)
YP := Y;
YP := Y;
YP := (2*Y - x*Y)/3;
Numeric value that specifies the initial value of the independent variable.
Array that specifies the initial values of the dependent variables of the first order system. These values must be present in this array in the same order as that used by the procedure given in the procedure argument.
List that specifies the names of the dependent variables corresponding to the indexed values in the solution procedure and the initial value array. For the above example, procvars=y⁡x,u⁡x,v⁡x can be used. To instead display solutions in the variables of the original ODE, procvars=y⁡x,ⅆⅆxy⁡x,ⅆ2ⅆx2y⁡x can be used.
When an ODE or ODE system is input directly (a system defined problem - does not use the procedure options), Maple converts the system to first order internally by renaming derivatives as new dependent variables. It obtains the number, procedure, start, initial, and procvars values from the input. In cases where both the system form and the procedure form of the input is present, the system form is ignored and a warning is issued.
Note: If the ODE system is provided in solved form with respect to the leading derivatives (the highest derivative of each dependent variable of the system), no algebraic manipulation of the system is done in obtaining the procedure form (other than derivative renaming to new dependent variables). This allows better control of the actual computation of the derivatives in the system. If any of the equations in the ODE system are not in solved form, solve is called to obtain the solved form, which means that certain undesirable side effects may occur (for example, consider solve(y-(x+1)^20-1,y) ).
Argument that can only be true for ODE systems that are linear in the leading derivatives, and can only be used with the rkf45, ck45, rosenbrock, dverk78, gear, lsode, and classical methods with system-defined problems. By default, this option is false, but setting this option to true tells dsolve[numeric] to leave the system in unsolved form, and compute the derivative values through a linear solve each time they are needed. This means that a method requiring n function evaluations per step must perform n linear solves per step.
Though use of this option slows the computation in most cases, it is necessary for ODE systems that have complicated coefficients, for which the isolation of the leading derivatives would result in excessive expression swell, or an ill-conditioned function to compute the derivative values. This behavior occurs frequently in mapping solutions of polynomial systems to solutions of differential systems using homotopy methods.
Arguments that are only available for the rkf45, ck45, and rosenbrock methods, and are used to specify and control the behavior of events. These options are discussed in detail in dsolve[Events].
Boolean that controls the behavior of the numerical integration with respect to consecutive calculations. If startinit=true is specified, each calculation begins at the initial point of the problem. If startinit=false (the default setting), then each calculation begins where the prior calculation ended, provided it does not reverse the direction of the integration. If doing so would reverse the integration direction, the computation is started from the initial point.
For the methods, rkf45, ck45, and rosenbrock, the solution is only recomputed when the new value of the independent variable is not between the initial point and any other previously requested solution point. This has the effect of never reversing the direction of integration, and making evaluation of the solution for an already computed interval quite inexpensive (the solution values are obtained by interpolation). The storage of the solution can be disabled by using the storage argument. The startinit parameter also tells these methods to recompute the solution whenever a solution value is desired.
For all IVP methods, you may specify that the problem is complex with the complex option. Note that this option is not available for the other numeric methods. For the default stiff and nonstiff IVP methods, it may be necessary to specify when the problem is complex. The default value is false.
The minstep, maxstep, and initstep options are discussed in dsolve[Error_Control].
In addition to computation of solution values for the given input problem, the procedure returns (that is, output=procedurelist, listprocedure or operator) provide additional interactive features, including the ability to specify parameters. Information on these features is provided on the dsolve[numeric,interactive] page.
Initial value problem with solution y⁡x=sin⁡x, integrated in both directions:
dsol1 ≔ procx_gear...end proc
dsol2≔t=proct...end proc,x⁡t=proct...end proc,y⁡t=proct...end proc
Lorenz system using procedure specification:
dproc3 := proc(N,t,Y,YP)
YP := sigma * (Y - Y);
YP := r*Y - Y*Y - Y;
YP := Y*Y - b*Y;
dsol3 ≔ procx_rkf45...end proc
The following is a problem (of the form ⅇx⁢y''+sin⁡x⁢y⁡x=0 ) where the natural naming of the variables is not the desired one. Choose the first dependent variable as y⁡x, and the second as v⁡x=ⅇx⁢y'⁡x, and use the procedure specification of the problem.
dproc4 := proc(N,x,Y,YP)
YP := exp(-x)*Y;
YP := -sin(x)*Y;
dproc4 ≔ procN,x,Y,YPYP ≔ exp⁡−x*Y;YP ≔ −sin⁡x*Yend proc
dsol4 ≔ procx_rkf45...end proc
A complex-valued initial value problem:
dsol5 ≔ procx_gear...end proc
dsoli ≔ procx_rkf45...end proc
Perform a computation.
Query the initial value, last computed value, and method.
Compute up to a singularity.
Error, (in dsoli) cannot evaluate the solution further right of .99999999, probably a singularity
Query closest point to singularity that the method obtained.
Change initial condition, and recompute.
Error, (in dsoli) cannot evaluate the solution further right of 2.9999999, probably a singularity
Now listprocedure output:
dsoli2≔x=procx...end proc,y⁡x=procx...end proc
dsx ≔ procx...end proc
dsy ≔ procx...end proc
Compute and query.
Change the initial x point only, and compute y⁡1.5.
Error, (in dsy) cannot evaluate the solution further right of 2.9999999, probably a singularity
Download Help Document
What kind of issue would you like to report? (Optional)