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.

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

Verify by differentiating.

 > D(de1)-de1;
 ${0}$ (2)

The equivalent equation, as a function:

 > de2 := DESol( diff(y(x),x)-y(x), y(x) );
 ${\mathrm{de2}}{≔}{\mathrm{DESol}}{}\left(\left\{\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){-}{y}{}\left({x}\right)\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right)$ (3)
 > de1(x)-de2;
 ${0}$ (4)
 > diff(de2,x)-de2;
 ${0}$ (5)

The unapply command can convert from function to operator.

 > unapply(de2,x)-de1;
 ${0}$ (6)

A more complex equation, using initial conditions.

 > alias(de3= DESol( D(D(y))-a*x*D(y)+y, y )): D(x) := 1: D(a) := 0:
 > D(D(D(de3)));
 ${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)
 > collect( D(D(D(D(de3)))), D(de3), factor);
 ${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)
 > int( de3(x), x);
 ${\mathrm{DESol}}{}\left(\left\{{y}{}\left({x}\right){-}\frac{{x}{}{a}{}\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right)}{{a}{+}{1}}{+}\frac{\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)}{{a}{+}{1}}\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right)$ (9)
 > int( 1/ln(de3(x)),x );
 ${\mathrm{DESol}}{}\left(\left\{\frac{{2}{}{\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right)}^{{2}}{}{{ⅇ}}^{\frac{{1}}{\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)}}}{{\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right)}^{{3}}}{-}\frac{\left(\frac{{{ⅆ}}^{{3}}}{{ⅆ}{{x}}^{{3}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right){}{{ⅇ}}^{\frac{{1}}{\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)}}}{{\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right)}^{{2}}}{+}\frac{{\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right)}^{{2}}{}{{ⅇ}}^{\frac{{1}}{\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)}}}{{\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right)}^{{4}}}{+}\frac{{a}{}{x}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right){}{{ⅇ}}^{\frac{{1}}{\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)}}}{{\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right)}^{{2}}}{+}{{ⅇ}}^{\frac{{1}}{\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)}}\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right)$ (10)

An example with non-linear DE's:

 > alias(de5= DESol( D(D(y))/D(y)=y )) :
 > D(D(de5))/D(de5)-de5;
 ${0}$ (11)
 > D(D(D(de5)));
 ${{\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:

 > D(x) := 'D(x)':
 > de6 := DESol( diff(x(t),t,t) = g/l*sin(x(t)), x(t), {x(0)=0, D(x)(0)=v0} );
 ${\mathrm{de6}}{≔}{\mathrm{DESol}}{}\left(\left\{\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{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)
 > de7 := int(de6,t);
 ${\mathrm{de7}}{≔}{\mathrm{DESol}}{}\left(\left\{\frac{{{ⅆ}}^{{3}}}{{ⅆ}{{t}}^{{3}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{x}{}\left({t}\right){-}\frac{{g}{}{\mathrm{sin}}{}\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{x}{}\left({t}\right)\right)}{{l}}\right\}{,}\left\{{x}{}\left({t}\right)\right\}\right)$ (14)

Verify the derivative.

 > diff(de7,t,t,t)-g/l*sin(diff(de7,t));
 ${0}$ (15)

A complex integration.

 > de8 := int(1/(DESol(diff(y(x),x)-y(x),y(x))+1),x);
 ${\mathrm{de8}}{≔}{\mathrm{ln}}{}\left({\mathrm{DESol}}{}\left(\left\{\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{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}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right){-}{y}{}\left({x}\right)\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right){+}{1}\right)$ (16)
 > normal( diff(de8,x)-1/(DESol(diff(y(x),x)-y(x),y(x))+1));
 ${0}$ (17)

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

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

An example where the equation can be simplified.

 > de9 := DESol( diff(y(x),x,x)*diff(y(x),x)-1, y(x) );
 ${\mathrm{de9}}{≔}{\mathrm{DESol}}{}\left(\left\{\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right){}\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right){-}{1}\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right)$ (20)
 > diff(de9,x);
 ${\mathrm{DESol}}{}\left(\left\{\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{y}{}\left({x}\right)\right){}{y}{}\left({x}\right){-}{1}\right\}{,}\left\{{y}{}\left({x}\right)\right\}\right)$ (21)
 > de10 := unapply(de9,x);
 ${\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)
 > D(de10);
 ${\mathrm{DESol}}{}\left(\left\{{y}{}{\mathrm{D}}{}\left({y}\right){-}{1}\right\}{,}\left\{{y}\right\}\right)$ (23)