DEtools
varparam
find the general solution of an ODE by the method of variation of parameters
Calling Sequence
Parameters
Description
Examples
varparam(sols, v, ivar)
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
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](..).
with⁡DEtools:
Here is an example using the general formula in the order 2 case:
varparam⁡u1⁡x,u2⁡x,g⁡x,x
_C1⁢u1⁡x+_C2⁢u2⁡x−∫u2⁡x⁢g⁡xu1⁡x⁢ⅆⅆxu2⁡x−u2⁡x⁢ⅆⅆxu1⁡xⅆx⁢u1⁡x+∫u1⁡x⁢g⁡xu1⁡x⁢ⅆⅆxu2⁡x−u2⁡x⁢ⅆⅆxu1⁡xⅆx⁢u2⁡x
You can obtain a specific particular solution in the order 2 case:
varparam⁡u1⁡x,u2⁡x,g⁡x,x,true
−∫u2⁡x⁢g⁡xu1⁡x⁢ⅆⅆxu2⁡x−u2⁡x⁢ⅆⅆxu1⁡xⅆx⁢u1⁡x+∫u1⁡x⁢g⁡xu1⁡x⁢ⅆⅆxu2⁡x−u2⁡x⁢ⅆⅆxu1⁡xⅆx⁢u2⁡x
de≔diff⁡Y⁡x,x,x+Y⁡x:
sols≔dsolve⁡de,Y⁡x,output=basis
sols≔sin⁡x,cos⁡x
varparam⁡sols,csc⁡x,x
_C1⁢sin⁡x+_C2⁢cos⁡x−ln⁡csc⁡x⁢sin⁡x−x⁢cos⁡x
Here is another way to get the same information:
dsolve⁡de=csc⁡x,Y⁡x
Y⁡x=sin⁡x⁢c__2+cos⁡x⁢c__1−ln⁡csc⁡x⁢sin⁡x−x⁢cos⁡x
As a second example, consider the ODE D2⁡z⁡x−3⁢D⁡z⁡x+2⁢z⁡x=Rhs with
Rhs≔x⁢exp⁡x+2⁢x:
and
sols≔exp⁡x,exp⁡2⁢x:
The general solution is using the method of variation of parameters is:
varparam⁡sols,Rhs,x,true
−ⅇ3⁢x⁢x2+2⁢x⁢ⅇ3⁢x−2⁢ⅇ2⁢x⁢x+2⁢ⅇ3⁢x−3⁢ⅇ2⁢x⁢ⅇ−2⁢x2
Final example: For the ODE ⅆ3ⅆx3y⁡x−2⁢ⅆ2ⅆx2y⁡x−ⅆⅆxy⁡x+2⁢y⁡x=ⅇx, sols=ⅇx,ⅇ2⁢x,ⅇ−x. The general solution is:
varparam⁡exp⁡x,exp⁡2⁢x,exp⁡−x,exp⁡x,x
_C1⁢ⅇx+_C2⁢ⅇ2⁢x+_C3⁢ⅇ−x−x⁢ⅇx2−ⅇx4
See Also
dsolve
Download Help Document