MaplePortal/DAE - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : MaplePortal/DAE

Differential-Algebraic Equations in Maple

Overview of Maple's Differential Equations Solvers

Maple's differential equation solvers employ advanced techniques to solve:

 • Ordinary differential equations (ODEs): dsolve solves linear and nonlinear ODEs, initial value problems (IVPs), and boundary value problems (BVPs) symbolically or numerically.  The ODE Analyzer Assistant provides an interactive way to solve an ODE and plot the solution.  See dsolve, dsolve/numeric, and ODE Analyzer for more information.

 • Partial differential equations (PDEs): pdsolve finds exact solutions to PDEs.  Use Maple's PDE tools to perform structural analysis and order reduction for PDE systems.  pdsolve/numeric handles systems of time-dependent PDEs in one spatial dimension with boundary conditions.  Includes 11 standard methods for numerically solving PDEs, particularly useful in education.  See pdsolve and pdsolve/numeric for more information.

 • Differential-Algebraic Equations (DAEs):   dsolve/numeric's hybrid symbolic-numeric solvers, using symbolic pre-processing and order reduction, enable Maple to solve many high-index DAE problems.  Maple has four solvers for handling DAEs: 1) Modified Runge-Kutta Fehlberg method, 2) Cash-Karp Pair Runge-Kutta method, 3) Rosenbrock method, and 4) Modified Extended Backward-Differentiation Implicit method.

DAEs in Maple

More highlights:

 • In most cases dsolve is able to detect if a given problem is a DAE system, as opposed to an ODE system, by identifying whether a pure algebraic equation in the dependent variables is 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.

 • dsolve has four methods for finding numeric solutions to DAEs.  The default DAE IVP method is a modified Runge-Kutta Fehlberg method (rkf45_dae).  The other methods, ck45_dae (an extension of the ck45 method, a Runge-Kutta method with the Cash-Karp coefficients), rosenbrock_dae (an extension of the rosenbrock method, an Implicit Rosenbrock third-fourth order Runge-Kutta method with degree three interpolant), and mebdfi (Modified Extended Backward-Differentiation Formula Implicit method) can be specified using the method option.  If you specify that the problem is stiff with the option stiff=true without selecting a method, then the method rosenbrock_dae will be used.

 • Maple's core numeric ODE and DAE IVP solvers (rkf45, ck45, rosenbrock, and the DAE versions of these) can handle user-defined events.

For more information on solving DAEs, see dsolve/numeric and dsolve/numeric/DAE.

In this document, we solve two DAE problems, one by simply calling dsolve/numeric and using the default DAE solver and the second by specifying in the call to dsolve/numeric that the stiff solver should be used.

Higher-Index DAEs in Maple: Simple Pendulum in Cartesian Coordinates

In this example, we model a simple pendulum in Cartesian coordinates.  The equations result in an index-3 DAE, which we solve using dsolve with the numeric option.  Then, we plot the solution using plots[odeplot].  We begin by loading the plots package.

$\mathrm{with}\left(\mathrm{plots}\right):$

Equations of motion:

 $\frac{{ⅆ}}{{ⅆ}{t}}{}{\mathrm{vx}}{}\left({t}\right){=}{F}{}\left({t}\right){}{x}{}\left({t}\right)$ (1)

 $\frac{{ⅆ}}{{ⅆ}{t}}{}{\mathrm{vy}}{}\left({t}\right){=}{F}{}\left({t}\right){}{y}{}\left({t}\right){-}{g}$ (2)

 $\frac{{ⅆ}}{{ⅆ}{t}}{}{x}{}\left({t}\right){=}{\mathrm{vx}}{}\left({t}\right)$ (3)

 $\frac{{ⅆ}}{{ⅆ}{t}}{}{y}{}\left({t}\right){=}{\mathrm{vy}}{}\left({t}\right)$ (4)

$\mathrm{eq5}≔x{\left(t\right)}^{2}+y{\left(t\right)}^{2}-1=0$

 ${{x}{}\left({t}\right)}^{{2}}{+}{{y}{}\left({t}\right)}^{{2}}{-}{1}{=}{0}$ (5)

$x\left(t\right)$ and $y\left(t\right)$ are the position of the pendulum, and $F\left(t\right)$ is the compressive force in the rigid link.  (Note that $F\left(t\right)$ is also the Lagrange multiplier of the problem.)

The index of the system can be determined by repeated differentiation of the constraint equation ($\mathrm{eq5}$):

 ${2}{}{x}{}\left({t}\right){}{\mathrm{vx}}{}\left({t}\right){+}{2}{}{y}{}\left({t}\right){}{\mathrm{vy}}{}\left({t}\right)$ (6)

 ${2}{}{{\mathrm{vx}}{}\left({t}\right)}^{{2}}{+}{2}{}{{x}{}\left({t}\right)}^{{2}}{}{F}{}\left({t}\right){+}{2}{}{{\mathrm{vy}}{}\left({t}\right)}^{{2}}{+}{2}{}{y}{}\left({t}\right){}\left({F}{}\left({t}\right){}{y}{}\left({t}\right){-}{g}\right)$ (7)

 $\left({2}{}{{x}{}\left({t}\right)}^{{2}}{+}{2}{}{{y}{}\left({t}\right)}^{{2}}\right){}\left(\frac{{ⅆ}}{{ⅆ}{t}}{}{F}{}\left({t}\right)\right){+}{8}{}{\mathrm{vx}}{}\left({t}\right){}{F}{}\left({t}\right){}{x}{}\left({t}\right){+}{6}{}{\mathrm{vy}}{}\left({t}\right){}\left({F}{}\left({t}\right){}{y}{}\left({t}\right){-}{g}\right){+}{2}{}{y}{}\left({t}\right){}{F}{}\left({t}\right){}{\mathrm{vy}}{}\left({t}\right)$ (8)

Since the coefficient of  in the last equation is $\ne 0$ (see $\mathrm{eq5}$), this equation is an ODE and the index of the system of equations is 3. (It takes three differentiations of the constraint equation in order to get an ODE.)

Now, solve this system and plot the solutions:

 ${\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}}$ (9)

$\mathrm{odeplot}\left(\mathrm{sol},\left[\left[t,x\left(t\right)\right],\left[t,y\left(t\right)\right]\right],t=0..2\right)$

$\mathrm{odeplot}\left(\mathrm{sol},\left[\left[t,\mathrm{vx}\left(t\right)\right],\left[t,\mathrm{vy}\left(t\right)\right]\right],t=0..2\right)$

$\mathrm{odeplot}\left(\mathrm{sol},\left[\left[t,F\left(t\right)\right]\right],t=0..2\right)$



Solving a Stiff DAE Problem: Example from Physical Chemistry

Here is a three variable problem from physical chemistry that is not solved by Maple's default numeric ODE solver, but can be solved by specifying a stiff solver.  When the option stiff=true is specified to dsolve along with the numeric option, Maple uses the method rosenbrock_dae.

To begin, we use PDEtools[declare] to display derivatives with the prime $\left('\right)$ symbol.

$\mathrm{restart};$

$\mathrm{with}\left(\mathrm{plots}\right):$

$\mathrm{PDEtools}\left[\mathrm{declare}\right]\left(\mathrm{prime}=t\right);$

 ${\mathrm{derivatives with respect to}}{}{t}{}{\mathrm{of functions of one variable will now be displayed with \text{'}}}$ (10)

In this example, the solution is constrained to lie on the plane $a\left(t\right)+b\left(t\right)+c\left(t\right)=1$.

$\mathrm{sys}:=\left\{\frac{ⅆ}{ⅆt}a\left(t\right)=-\frac{a\left(t\right)}{10}+10000b\left(t\right)c\left(t\right),\frac{ⅆ}{ⅆt}b\left(t\right)=\frac{a\left(t\right)}{10}-10000b\left(t\right)c\left(t\right)-10000000{b\left(t\right)}^{2},a\left(t\right)+b\left(t\right)+c\left(t\right)=1,a\left(0\right)=1,b\left(0\right)=0\right\}$

 $\left\{{\mathrm{a\text{'}}}{=}{-}\frac{{1}}{{10}}{}{a}{}\left({t}\right){+}{10000}{}{b}{}\left({t}\right){}{c}{}\left({t}\right){,}{\mathrm{b\text{'}}}{=}\frac{{1}}{{10}}{}{a}{}\left({t}\right){-}{10000}{}{b}{}\left({t}\right){}{c}{}\left({t}\right){-}{10000000}{}{{b}{}\left({t}\right)}^{{2}}{,}{a}{}\left({t}\right){+}{b}{}\left({t}\right){+}{c}{}\left({t}\right){=}{1}{,}{a}{}\left({0}\right){=}{1}{,}{b}{}\left({0}\right){=}{0}\right\}$ (11)

The default numeric solver fails on the desired range.

$\mathrm{dsolve}\left(\mathrm{sys},\mathrm{numeric},\mathrm{range}=0..40000\right):$

The problem here is that using the default numerical solver the computation becomes too expensive beyond $t=6.4957591$, exceeding the maxfun limit of 30000 evaluations. If it takes too long to solve the IVP using the default rkf45 solver, then the system might be stiff.  In this case, we can solve the problem using the modified Rosenbrock method by specifying stiff=true.

 ${\mathbf{proc}}\left({\mathrm{x_rosenbrock_dae}}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (12)



For more information on solving stiff IVPs in Maple, see dsolve/Stiffness.

 See Also dsolve, dsolve/numeric, dsolve/numeric/DAE, dsolve/Stiffness, ODE Analyzer, pdsolve, plots[odeplot]