varparam - Maple Help

DEtools

 varparam
 find the general solution of an ODE by the method of variation of parameters

 Calling Sequence varparam(sols, v, ivar)

Parameters

 sols - list of solutions to the corresponding homogeneous equation v - right hand side of the original ODE ivar - independent variable true - (optional) flag to return only the particular solution

Description

 • The varparam routine is used to find a general solution of an ordinary differential equation (ODE) by the method of variation of parameters.  In the event that no solution form can be generated (that is, if the Wronskian of the solution list sols is zero), then FAIL is returned. Otherwise, an general solution is generated, with indexed global constants _C.
 • The list sols must be a list of linearly independent solutions to a corresponding homogeneous ODE. The second argument, v, is the right-hand-side of a linear ODE where it is assumed that the coefficient of the highest derivative is equal to one. If this right-hand-side is zero, then 0 is the only particular solution.
 • If a fourth argument true is added, the routine returns only the particular solution.
 • This function is part of the DEtools package, and so it can be used in the form varparam(..) only after executing the command with(DEtools). However, it can always be accessed through the long form of the command by using DEtools[varparam](..).

Examples

 > $\mathrm{with}\left(\mathrm{DEtools}\right):$

Here is an example using the general formula in the order 2 case:

 > $\mathrm{varparam}\left(\left[\mathrm{u1}\left(x\right),\mathrm{u2}\left(x\right)\right],g\left(x\right),x\right)$
 ${{\mathrm{_C}}}_{{1}}{}{\mathrm{u1}}{}\left({x}\right){+}{{\mathrm{_C}}}_{{2}}{}{\mathrm{u2}}{}\left({x}\right){-}\left({\int }\frac{{\mathrm{u2}}{}\left({x}\right){}{g}{}\left({x}\right)}{{\mathrm{u1}}{}\left({x}\right){}\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{u2}}{}\left({x}\right)\right){-}{\mathrm{u2}}{}\left({x}\right){}\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{u1}}{}\left({x}\right)\right)}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}\right){}{\mathrm{u1}}{}\left({x}\right){+}\left({\int }\frac{{\mathrm{u1}}{}\left({x}\right){}{g}{}\left({x}\right)}{{\mathrm{u1}}{}\left({x}\right){}\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{u2}}{}\left({x}\right)\right){-}{\mathrm{u2}}{}\left({x}\right){}\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{u1}}{}\left({x}\right)\right)}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}\right){}{\mathrm{u2}}{}\left({x}\right)$ (1)

You can obtain a specific particular solution in the order 2 case:

 > $\mathrm{varparam}\left(\left[\mathrm{u1}\left(x\right),\mathrm{u2}\left(x\right)\right],g\left(x\right),x,\mathrm{true}\right)$
 ${-}\left({\int }\frac{{\mathrm{u2}}{}\left({x}\right){}{g}{}\left({x}\right)}{{\mathrm{u1}}{}\left({x}\right){}\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{u2}}{}\left({x}\right)\right){-}{\mathrm{u2}}{}\left({x}\right){}\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{u1}}{}\left({x}\right)\right)}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}\right){}{\mathrm{u1}}{}\left({x}\right){+}\left({\int }\frac{{\mathrm{u1}}{}\left({x}\right){}{g}{}\left({x}\right)}{{\mathrm{u1}}{}\left({x}\right){}\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{u2}}{}\left({x}\right)\right){-}{\mathrm{u2}}{}\left({x}\right){}\left(\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{u1}}{}\left({x}\right)\right)}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{x}\right){}{\mathrm{u2}}{}\left({x}\right)$ (2)
 > $\mathrm{de}≔\mathrm{diff}\left(Y\left(x\right),x,x\right)+Y\left(x\right):$
 > $\mathrm{sols}≔\mathrm{dsolve}\left(\mathrm{de},Y\left(x\right),\mathrm{output}=\mathrm{basis}\right)$
 ${\mathrm{sols}}{≔}\left[{\mathrm{sin}}{}\left({x}\right){,}{\mathrm{cos}}{}\left({x}\right)\right]$ (3)
 > $\mathrm{varparam}\left(\mathrm{sols},\mathrm{csc}\left(x\right),x\right)$
 ${{\mathrm{_C}}}_{{1}}{}{\mathrm{sin}}{}\left({x}\right){+}{{\mathrm{_C}}}_{{2}}{}{\mathrm{cos}}{}\left({x}\right){-}{\mathrm{ln}}{}\left({\mathrm{csc}}{}\left({x}\right)\right){}{\mathrm{sin}}{}\left({x}\right){-}{x}{}{\mathrm{cos}}{}\left({x}\right)$ (4)

Here is another way to get the same information:

 > $\mathrm{dsolve}\left(\mathrm{de}=\mathrm{csc}\left(x\right),Y\left(x\right)\right)$
 ${Y}{}\left({x}\right){=}{\mathrm{sin}}{}\left({x}\right){}{\mathrm{_C2}}{+}{\mathrm{cos}}{}\left({x}\right){}{\mathrm{_C1}}{-}{\mathrm{ln}}{}\left(\frac{{1}}{{\mathrm{sin}}{}\left({x}\right)}\right){}{\mathrm{sin}}{}\left({x}\right){-}{x}{}{\mathrm{cos}}{}\left({x}\right)$ (5)

As a second example, consider the ODE ${\mathrm{D}}^{\left(2\right)}\left(z\right)\left(x\right)-3\mathrm{D}\left(z\right)\left(x\right)+2z\left(x\right)=\mathrm{Rhs}$ with

 > $\mathrm{Rhs}≔x\mathrm{exp}\left(x\right)+2x:$

and

 > $\mathrm{sols}≔\left[\mathrm{exp}\left(x\right),\mathrm{exp}\left(2x\right)\right]:$

The general solution is using the method of variation of parameters is:

 > $\mathrm{varparam}\left(\mathrm{sols},\mathrm{Rhs},x,\mathrm{true}\right)$
 ${-}\frac{\left({{ⅇ}}^{{3}{}{x}}{}{{x}}^{{2}}{+}{2}{}{x}{}{{ⅇ}}^{{3}{}{x}}{-}{2}{}{{ⅇ}}^{{2}{}{x}}{}{x}{+}{2}{}{{ⅇ}}^{{3}{}{x}}{-}{3}{}{{ⅇ}}^{{2}{}{x}}\right){}{{ⅇ}}^{{-}{2}{}{x}}}{{2}}$ (6)

Final example: For the ODE $\frac{{ⅆ}^{3}}{ⅆ{x}^{3}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}y\left(x\right)-2\frac{{ⅆ}^{2}}{ⅆ{x}^{2}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}y\left(x\right)-\frac{ⅆ}{ⅆx}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}y\left(x\right)+2y\left(x\right)={ⅇ}^{x}$, $\mathrm{sols}=\left[{ⅇ}^{x},{ⅇ}^{2x},{ⅇ}^{-x}\right]$.  The general solution is:

 > $\mathrm{varparam}\left(\left[\mathrm{exp}\left(x\right),\mathrm{exp}\left(2x\right),\mathrm{exp}\left(-x\right)\right],\mathrm{exp}\left(x\right),x\right)$
 ${{\mathrm{_C}}}_{{1}}{}{{ⅇ}}^{{x}}{+}{{\mathrm{_C}}}_{{2}}{}{{ⅇ}}^{{2}{}{x}}{+}{{\mathrm{_C}}}_{{3}}{}{{ⅇ}}^{{-}{x}}{-}\frac{{x}{}{{ⅇ}}^{{x}}}{{2}}{-}\frac{{{ⅇ}}^{{x}}}{{4}}$ (7)