dsolve/numeric/DAE  find numerical solution of differentialalgebraic initial value problems

Calling Sequence


dsolve(daesys, numeric, vars, options)


Parameters


daesys



set or list; ordinary differential equation(s), algebraic equation(s) and initial conditions

numeric



name; instruct dsolve to find a numerical solution

vars



(optional) dependent variable or a set or list of dependent variables for daesys

options



(optional) equations of the form keyword = value





Description


•

The dsolve command with the numeric or type=numeric option and a realvalued differentialalgebraic initial value problem (DAE IVP) finds a numerical solution for the DAE IVP. If the optional equation method=numericmethod is provided (where numericmethod is one of rkf45_dae, ck45_dae, rosenbrock_dae, or mebdfi), dsolve uses that method to obtain the numerical solution.


In most cases dsolve is able to detect if the problem is a DAE system, as opposed to an ODE system, namely the cases in which pure algebraic equations in the dependent variables are present. If the input is a DAE system containing no purely algebraic equations, the method must be included to specify that the system is a DAE system.

•

Constrained mechanical systems often give rise to DAE problems. (See the pendulum example below.)

'output'

=

keyword or array

'range'

=

numeric..numeric

'abserr'

=

numeric or list

'relerr'

=

numeric

'stiff'

=

boolean

'known'

=

name or list of names

'optimize'

=

boolean




The exception is that for the DAE solvers the absolute error tolerance can be specified as a percomponent list. For expected behavior, the variables of the problem must also be specified as a list, and the entries of 'abserr' must correspond 11 to the variables in the list, or to the variables in the system converted to first order using the order of the variables in the list. For more information, see the ?dsolve[numeric,IVP] help page.

•

The default DAE IVP method is a modified RungeKutta Fehlberg method, which uses a base order 45 method, but has been modified to find solutions for DAE problems. The default stiff method is a Rosenbrock method, which uses a base order 34 method. For a description of the modifications done to these methods in extending them to DAE solution, see the ?dae_extension help page. The other method available for DAE IVP is the dsolve[mebdfi] method, which is short for Modified Extended BackwardDifferentiation Formula Implicit method.

•

In general, the DAE IVP solvers are very similar to the standard differential IVP solvers, so this page is primarily concerned with outlining the differences between them.

•

The DAE solvers are currently restricted to finding solutions for realvalued problems.

•

For use of any of the methods, the specified initial conditions must satisfy all hidden constraints of the system (that is, they must be a consistent set of initial conditions with respect to the DAE). In the event that they do not, an error results, and information is provided on the unsatisfied condition.


In some cases, it may be necessary to use fsolve to compute consistent initial conditions for the problem.

•

If the ?dae_extension methods are in use, the differential option is set to true, and the system is sufficiently linear in the algebraic variables (i.e., variables which have no derivatives appearing in the input system), it is possible to skip initial conditions for those variables. If the initial conditions are skipped when they are required, an error will be produced.

•

The following options are also available for some or all of the DAE methods:

'minstep'

=

numeric

'maxstep'

=

numeric

'initstep'

=

numeric

'startinit'

=

boolean

'events'

=

list

'event_pre'

=

keyword

'event_maxiter'

=

integer

'projection'

=

boolean

'differential'

=

boolean

'implicit'

=

boolean

'parameters'

=

list of names




'minstep', 'maxstep', and 'initstep'


This option controls the behavior of the numerical integration with respect to consecutive calculations. This option is described in dsolve[numeric,IVP].


For the methods, rkf45_dae, ck45_dae, and rosenbrock_dae, when a 'range' has been specified, the solution is recomputed only 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 also be enabled by using the storage argument. The startinit parameter also forces these methods to recompute the solution whenever a solution value is desired.


'projection', 'differential', and 'implicit'


The 'projection', 'differential' and 'implicit' options are specific to the extension methods, so they are discussed there.

•

In addition to the 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. The exception is that the mebdfi method cannot work with parametrized problems.



Examples


As a first example, we consider the problem of modeling the dynamics of a mass on a string of unit length in 2D Cartesian coordinates (the pendulum problem). We let be the position of the mass on the string, and the velocity:
>


>


>


 (1) 
>


 (2) 
Since the mass is on a string of fixed length , we have the constraint:
>


 (3) 
Now we want to construct the DAE system using the EulerLagrange formulation, so we compute the kinetic energy and the potential energy as:
>


 (4) 
>


 (5) 
where is the mass, and is the gravitational constant (we will use 9.8). The Lagrangian and modified Lagrangian are given by:
>


 (6) 
>


 (7) 
We can then construct the EulerLagrange formulation via:
>


 (8) 
>


 (9) 
>


 (10) 
>


 (11) 
Now we have the equations of motion for the pendulum. Next, we need to determine consistent initial conditions. To do so, we must identify any hidden constraints of the system. These are easy to find, as we have only one constraint.
>


 (12) 
>


 (13) 
Our initial conditions must satisfy , , and at the initial point, leaving only 2 degrees of freedom for the conditions. So for a pendulum starting at the minimum value of having an initial horizontal velocity of , we get:
>


 (14) 
>


 (15) 
So we consider the above with a pendulum of unit length having unit mass and an initial horizontal velocity of , giving us the DAE system and initial conditions:
>


 (16) 
>


 (17) 
We can then obtain the solution as:
>


 (18) 
>


 (19) 
>


 (20) 
Solution with rosenbrock_dae:
>


 (21) 
>


 (22) 
>


 (23) 
Solution with mebdfi:
>


 (24) 
>


 (25) 
>


 (26) 
Now consider a similar problem as above, but in addition add a second mass supported from the first by another string, this one of length 1/2 (the double pendulum). The system can be obtained and solved as:
>


 (27) 
>


 (28) 
>


 (29) 
The trajectory of the second mass can be plotted via:
>


Note that we did not specify initial conditions for and as we were using an extension method, and the system was sufficiently linear in the lambda.


See Also


dsolve/dae_extension, dsolve/Error_Control, dsolve[ck45], dsolve[Events], dsolve[maxfun], dsolve[mebdfi], dsolve[numeric,interactive], dsolve[numeric,IVP], dsolve[numeric], dsolve[rkf45], dsolve[rosenbrock], dsolve[Stiffness], plots[odeplot]

