dsolve/numeric/IVP  find numerical solution of ODE initial value problems

Calling Sequence


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


Parameters


odesys



set or list; ordinary differential equation(s) and initial 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 proceduredefined system (procedure, initial, start, number, and procvars). For more information, see below.

options



(optional) equations of the form keyword = value





Description


•

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.

'output' =

keyword or array

'range' =

numeric..numeric

'abserr' =

numeric or list

'relerr' =

numeric

'stiff' =

boolean

'known' =

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 11 correspondence between the specified variables and the specified abserr.


The percomponent 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.

•

All IVP methods, with the exception of taylorseries, can work with a complexvalued IVP with a realvalued independent variable.

•

The following options are specific to IVP, and are concerned with specification of the input system in procedure form (procopts):

'number' =

integer

'procedure' =

procedure

'start' =

numeric

'initial' =

array

'procvars' =

list




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:

'startinit' =

boolean

'minstep' =

numeric

'maxstep' =

numeric

'initstep' =

numeric

'events' =

list

'event_pre' =

keyword

'event_maxiter' =

integer

'implicit' =

boolean

'parameters' =

list of names

'complex' =

boolean



•

Before discussion of the procedurebased 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 , 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 procedurebased options more precisely. In all that follows, any reference to the system or dependent variables refers only to the first order system.


Options



The number of dependent variables in the first order system.


For the above example, given that the correspondence of the variables is , and , the following procedure correctly evaluates the derivatives of the ODE system.

solproc := proc(N, x, Y, YP)

YP[1] := Y[2];

YP[2] := Y[3];

YP[3] := (2*Y[2]  x*Y[1])/3;

end proc;




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, can be used. To instead display solutions in the variables of the original ODE, 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)^201,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 systemdefined 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 function evaluations per step must perform 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 illconditioned 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.

•

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.




Examples


Initial value problem with solution , integrated in both directions:
>


 (1) 
>


 (2) 
>


 (3) 
>


 (4) 
IVP system:
>


 (5) 
>


>


 (6) 
>


>


 (7) 
>


 (8) 
>


 (9) 
Lorenz system using procedure specification:
>

dproc3 := proc(N,t,Y,YP)
YP[1] := sigma * (Y[2]  Y[1]);
YP[2] := r*Y[1]  Y[1]*Y[3]  Y[2];
YP[3] := Y[1]*Y[2]  b*Y[3];
end proc:

>


>


>


 (10) 
>


 (11) 
>


 (12) 
>


 (13) 
The following is a problem (of the form ) where the natural naming of the variables is not the desired one. Choose the first dependent variable as , and the second as , and use the procedure specification of the problem.
>

dproc4 := proc(N,x,Y,YP)
YP[1] := exp(x)*Y[2];
YP[2] := sin(x)*Y[1];
end proc;

 (14) 
>


>


>


 (15) 
>


 (16) 
>


 (17) 
>


 (18) 
A complexvalued initial value problem:
>


 (19) 
>


 (20) 
>


 (21) 
>


 (22) 
>


 (23) 
Interactive examples:
>


 (24) 
>


 (25) 
Perform a computation.
>


 (26) 
Query the initial value, last computed value, and method.
>


 (27) 
>


 (28) 
>


 (29) 
Compute up to a singularity.
>


Query closest point to singularity that the method obtained.
>


 (30) 
Change initial condition, and recompute.
>


 (31) 
>


>


 (32) 
Now listprocedure output:
>


 (33) 
>


 (34) 
>


 (35) 
Compute and query.
>


 (36) 
>


 (37) 
Change the initial x point only, and compute .
>


 (38) 
>


 (39) 
Change both.
>


 (40) 
>


>


 (41) 


See Also


dsolve/Error_Control, dsolve[ck45], dsolve[classical], dsolve[dverk78], dsolve[Events], dsolve[gear], dsolve[lsode], dsolve[maxfun], dsolve[numeric,DAE], dsolve[numeric,interactive], dsolve[numeric], dsolve[rkf45], dsolve[rosenbrock], dsolve[Stiffness], dsolve[taylorseries], plots[odeplot]

