DESol - Maple Programming Help

DESol

a data structure to represent the solution of a differential equation

 Calling Sequence DESol(expr) DESol(expr, y)

Parameters

 expr - differential equation in y y - variable

Description

 • DESol is a data structure to represent the solution of a differential equation. It is to dsolve as RootOf is to solve.
 • The DESol data structure makes manipulation of differential equations much easier. Its existence allows many hooks to the rest of Maple, diff, int, evalf, series, simplify, just to name the most prominent.
 • DESol can be used as an operator (using D), or as an expression (using diff(...,x)). The examples below illustrate some of the operations that can be performed with DESol.

Examples

A simple differential equation.

 > $\mathrm{de1}≔\mathrm{DESol}\left(\mathrm{D}\left(y\right)-y,y\right)$
 ${\mathrm{de1}}{≔}{\mathrm{DESol}}{}\left(\left\{{\mathrm{D}}{}\left({y}\right){-}{y}\right\}{,}\left\{{y}\right\}\right)$ (1)

Verify by differentiating.

 > $\mathrm{D}\left(\mathrm{de1}\right)-\mathrm{de1}$
 ${0}$ (2)

The equivalent equation, as a function:

 > $\mathrm{de2}≔\mathrm{DESol}\left(\frac{ⅆ}{ⅆx}y\left(x\right)-y\left(x\right),y\left(x\right)\right)$
 ${\mathrm{de2}}{≔}{\mathrm{DESol}}{}\left(\left\{\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right){-}{y}{}\left({x}\right)\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right)$ (3)
 > $\mathrm{de1}\left(x\right)-\mathrm{de2}$
 ${0}$ (4)
 > $\frac{\partial }{\partial x}\mathrm{de2}-\mathrm{de2}$
 ${0}$ (5)

The unapply command can convert from function to operator.

 > $\mathrm{unapply}\left(\mathrm{de2},x\right)-\mathrm{de1}$
 ${0}$ (6)

A more complex equation, using initial conditions.

 > $\mathrm{alias}\left(\mathrm{de3}=\mathrm{DESol}\left(\mathrm{D}\left(\mathrm{D}\left(y\right)\right)-ax\mathrm{D}\left(y\right)+y,y\right)\right):$$\mathrm{D}\left(x\right)≔1:$$\mathrm{D}\left(a\right)≔0:$
 > $\mathrm{D}\left(\mathrm{D}\left(\mathrm{D}\left(\mathrm{de3}\right)\right)\right)$
 ${a}{}{\mathrm{D}}{}\left({\mathrm{de3}}\right){+}{a}{}{x}{}\left({a}{}{x}{}{\mathrm{D}}{}\left({\mathrm{de3}}\right){-}{\mathrm{de3}}\right){-}{\mathrm{D}}{}\left({\mathrm{de3}}\right)$ (7)
 > $\mathrm{collect}\left(\mathrm{D}\left(\mathrm{D}\left(\mathrm{D}\left(\mathrm{D}\left(\mathrm{de3}\right)\right)\right)\right),\mathrm{D}\left(\mathrm{de3}\right),\mathrm{factor}\right)$
 ${a}{}{x}{}\left({{a}}^{{2}}{}{{x}}^{{2}}{+}{3}{}{a}{-}{2}\right){}{\mathrm{D}}{}\left({\mathrm{de3}}\right){-}{\mathrm{de3}}{}\left({{a}}^{{2}}{}{{x}}^{{2}}{+}{2}{}{a}{-}{1}\right)$ (8)
 > $∫\mathrm{de3}\left(x\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆx$
 ${\mathrm{DESol}}{}\left(\left\{{y}{}\left({x}\right){-}\frac{{x}{}{a}{}\left(\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)\right)}{{a}{+}{1}}{+}\frac{\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}{}{y}{}\left({x}\right)}{{a}{+}{1}}\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right)$ (9)
 > $∫\frac{1}{\mathrm{ln}\left(\mathrm{de3}\left(x\right)\right)}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆx$
 ${\mathrm{DESol}}{}\left(\left\{\frac{{2}{}{\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}{}{y}{}\left({x}\right)\right)}^{{2}}{}{{ⅇ}}^{\frac{{1}}{\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)}}}{{\left(\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)\right)}^{{3}}}{-}\frac{\left(\frac{{{ⅆ}}^{{3}}}{{ⅆ}{{x}}^{{3}}}{}{y}{}\left({x}\right)\right){}{{ⅇ}}^{\frac{{1}}{\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)}}}{{\left(\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)\right)}^{{2}}}{+}\frac{{\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}{}{y}{}\left({x}\right)\right)}^{{2}}{}{{ⅇ}}^{\frac{{1}}{\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)}}}{{\left(\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)\right)}^{{4}}}{+}\frac{{a}{}{x}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}{}{y}{}\left({x}\right)\right){}{{ⅇ}}^{\frac{{1}}{\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)}}}{{\left(\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)\right)}^{{2}}}{+}{{ⅇ}}^{\frac{{1}}{\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)}}\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right)$ (10)

An example with non-linear DE's:

 > $\mathrm{alias}\left(\mathrm{de5}=\mathrm{DESol}\left(\frac{\mathrm{D}\left(\mathrm{D}\left(y\right)\right)}{\mathrm{D}\left(y\right)}=y\right)\right):$
 > $\frac{\mathrm{D}\left(\mathrm{D}\left(\mathrm{de5}\right)\right)}{\mathrm{D}\left(\mathrm{de5}\right)}-\mathrm{de5}$
 ${0}$ (11)
 > $\mathrm{D}\left(\mathrm{D}\left(\mathrm{D}\left(\mathrm{de5}\right)\right)\right)$
 ${{\mathrm{D}}{}\left({\mathrm{de5}}\right)}^{{2}}{+}{{\mathrm{de5}}}^{{2}}{}{\mathrm{D}}{}\left({\mathrm{de5}}\right)$ (12)

The large oscillation pendulum equation, with initial conditions:

 > $\mathrm{D}\left(x\right)≔'\mathrm{D}\left(x\right)':$
 > $\mathrm{de6}≔\mathrm{DESol}\left(\frac{{ⅆ}^{2}}{ⅆ{t}^{2}}x\left(t\right)=\frac{g\mathrm{sin}\left(x\left(t\right)\right)}{l},x\left(t\right),\left\{x\left(0\right)=0,\mathrm{D}\left(x\right)\left(0\right)=\mathrm{v0}\right\}\right)$
 ${\mathrm{de6}}{≔}{\mathrm{DESol}}{}\left(\left\{\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}{}{x}{}\left({t}\right){-}\frac{{g}{}{\mathrm{sin}}{}\left({x}{}\left({t}\right)\right)}{{l}}\right\}{,}\left\{{x}{}\left({t}\right)\right\}{,}\left\{{x}{}\left({0}\right){=}{0}{,}{\mathrm{D}}{}\left({x}\right){}\left({0}\right){=}{\mathrm{v0}}\right\}\right)$ (13)
 > $\mathrm{de7}≔∫\mathrm{de6}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆt$
 ${\mathrm{de7}}{≔}{\mathrm{DESol}}{}\left(\left\{\frac{{{ⅆ}}^{{3}}}{{ⅆ}{{t}}^{{3}}}{}{x}{}\left({t}\right){-}\frac{{g}{}{\mathrm{sin}}{}\left(\frac{{ⅆ}}{{ⅆ}{t}}{}{x}{}\left({t}\right)\right)}{{l}}\right\}{,}\left\{{x}{}\left({t}\right)\right\}\right)$ (14)

Verify the derivative.

 > $\frac{{\partial }^{3}}{\partial {t}^{3}}\mathrm{de7}-\frac{g\mathrm{sin}\left(\frac{\partial }{\partial t}\mathrm{de7}\right)}{l}$
 ${0}$ (15)

A complex integration.

 > $\mathrm{de8}≔∫\frac{1}{\mathrm{DESol}\left(\frac{ⅆ}{ⅆx}y\left(x\right)-y\left(x\right),y\left(x\right)\right)+1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}ⅆx$
 ${\mathrm{de8}}{≔}{\mathrm{ln}}{}\left({\mathrm{DESol}}{}\left(\left\{\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right){-}{y}{}\left({x}\right)\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right)\right){-}{\mathrm{ln}}{}\left({\mathrm{DESol}}{}\left(\left\{\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right){-}{y}{}\left({x}\right)\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right){+}{1}\right)$ (16)
 > $\mathrm{normal}\left(\frac{\partial }{\partial x}\mathrm{de8}-\frac{1}{\mathrm{DESol}\left(\frac{ⅆ}{ⅆx}y\left(x\right)-y\left(x\right),y\left(x\right)\right)+1}\right)$
 ${0}$ (17)

When there are no derivatives, the equation can be written with RootOf or solved:

 > $\mathrm{DESol}\left({y\left(x\right)}^{2}-y\left(x\right)+1,y\left(x\right)\right)$
 ${\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{_Z}}{+}{1}\right)$ (18)
 > $\mathrm{DESol}\left(y\left(x\right)-x,y\left(x\right)\right)$
 ${x}$ (19)

An example where the equation can be simplified.

 > $\mathrm{de9}≔\mathrm{DESol}\left(\left(\frac{{ⅆ}^{2}}{ⅆ{x}^{2}}y\left(x\right)\right)\left(\frac{ⅆ}{ⅆx}y\left(x\right)\right)-1,y\left(x\right)\right)$
 ${\mathrm{de9}}{≔}{\mathrm{DESol}}{}\left(\left\{\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}{}{y}{}\left({x}\right)\right){}\left(\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)\right){-}{1}\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right)$ (20)
 > $\frac{\partial }{\partial x}\mathrm{de9}$
 ${\mathrm{DESol}}{}\left(\left\{\left(\frac{{ⅆ}}{{ⅆ}{x}}{}{y}{}\left({x}\right)\right){}{y}{}\left({x}\right){-}{1}\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right)$ (21)
 > $\mathrm{de10}≔\mathrm{unapply}\left(\mathrm{de9},x\right)$
 ${\mathrm{de10}}{≔}{\mathrm{DESol}}{}\left(\left\{{{\mathrm{D}}}^{\left({2}\right)}{}\left({y}\right){}{\mathrm{D}}{}\left({y}\right){-}{1}\right\}{,}\left\{{y}\right\}\right)$ (22)
 > $\mathrm{D}\left(\mathrm{de10}\right)$
 ${\mathrm{DESol}}{}\left(\left\{{y}{}{\mathrm{D}}{}\left({y}\right){-}{1}\right\}{,}\left\{{y}\right\}\right)$ (23)
 >