Maple dsolve in Education
Description
ODEs can be classified
Solutions using "this" or "that" method
Integrating factors and ODEs
The Lie symmetry approach for solving ODEs
Singular solutions for nonlinear ODEs
Most of the intermediate solving steps used by Maple dsolve are now available as user level commands, including all the steps of the integrating factor and symmetry approaches.
New optional arguments in dsolve also permit you to tackle a given ODE using methods you specify, and with or without performing the integration step, facilitating the understanding of the different possible solving methods, and the use of dsolve and related Maple commands in classroom.
The relevant command is odeadvisor. The capability of classifying ODEs was introduced in Maple 5. In subsequent versions, the list of classifications known by the system was enlarged, focusing in classifications traditionally found in textbooks, and also in new ones related to solving algorithms recently presented in the literature.
Example
If infolevel is set to a greater integer (possible settings are 1 through 5), more detailed information about the computation method is displayed.
with(DEtools):
with(PDEtools, declare):
declare(y(x), prime=x); # Turn ON the enhanced DEdisplay feature
y⁡x⁢will now be displayed as⁢y
derivatives with respect to⁢x⁢of functions of one variable will now be displayed with '
infolevel[dsolve] := 3;
infoleveldsolve≔3
ode1 := diff(y(x), x)-y(x)^2+y(x)*sin(x)-cos(x);
ode1≔y'−y2+y⁢sin⁡x−cos⁡x
This ODE is recognized by the system as of Riccati type
odeadvisor(ode1);
_Riccati
and solved accordingly:
dsolve(ode1);
Methods for first order ODEs: --- Trying classification methods --- trying a quadrature trying 1st order linear trying Bernoulli trying separable trying inverse linear trying homogeneous types: trying Chini differential order: 1; looking for linear symmetries trying exact Looking for potential symmetries trying Riccati trying Riccati sub-methods: <- Riccati with symmetry of the form [0, exp(-Int(f,x))/P*(y*P-f)^2] successful
y=−ⅇ−cos⁡xc__1+∫ⅇ−cos⁡xⅆx+sin⁡x
To know more about this type of ODE and related solving methods one can give the extra argument help:
odeadvisor(ode1, help);
A table with all the classifications recognized in Maple is found at odeadvisor, classifications.
dsolve accepts extra arguments related to the solving method to be used (a single ODE can usually be solved using different methods); it is also possible to avoid the integration step, or avoid making the answer explicit; (these last two steps may easily obscure the whole solving process).
A linear ODE
ode_L := sin(x)*diff(y(x), x)-cos(x)*y(x)=0;
ode_L≔y'⁢sin⁡x−cos⁡x⁢y=0
Although dsolve has its own strategy and defaults, one can also indicate to dsolve the use of any specific sequence of 'methods' to tackle the ODE. In this example the method for 'linear' ODEs is specified; in addition the optional argument 'useInt' makes dsolve not evaluating the integral appearing in the answer
dsolve(ode_L, [linear], useInt);
Classification methods on request Methods to be used are: [linear] ---------------------------- * Tackling ODE using method: linear --- Trying classification methods --- trying 1st order linear <- 1st order linear successful
y=c__1⁢ⅇ∫cot⁡xⅆx
Solutions like this one - before evaluating integrals - are useful to understand how the solution was obtained; integrals can be evaluated afterwards using value
value((7));
y=c__1⁢sin⁡x
This particular linear ODE is also separable, hence it can also be solved via
dsolve(ode_L, [separable], useInt);
Classification methods on request Methods to be used are: [separable] ---------------------------- * Tackling ODE using method: separable --- Trying classification methods --- trying separable <- separable successful
∫cot⁡xⅆx−∫` `y1_aⅆ_a+c__1=0
value((9));
ln⁡sin⁡x−ln⁡y+c__1=0
As a general alternative, ODEs can be tackled by looking for an integrating factor. The relevant commands in this approach are: intfactor, firint, firtest, muchange, mutest, adjoint.
The linear first order ODE of the previous section can be solved by first determining an integrating factor for it
mu := intfactor(ode_L);
μ≔1sin⁡x2
Integrating factors turn ODEs exact, that is: the product μ times the ODE is a total derivative. One can combine the determination of an integrating factor with indicating to dsolve the use of the method for exact ODEs:
dsolve(mu * ode_L, [exact]);
Classification methods on request Methods to be used are: [exact] ---------------------------- * Tackling ODE using method: exact --- Trying classification methods --- trying exact <- exact successful
y=−c__1csc⁡x
simplify(convert((12), sincos));
y=−c__1⁢sin⁡x
Integrating factors for second and higher order linear ODEs
For linear ODEs (LODEs) of order 2 or greater, it is possible to calculate integrating factors by solving the adjoint of the LODE. This could be as difficult as the original problem, or much easier, depending on the example. The set of DEtools available permits a discussion of such a strategy in details.
ode := diff(y(x), x, x) = (y(x)*x+y(x)*ln(x)*x^2+diff(y(x), x)*ln(x)*x^2)/ln(x)/x^2*exp(x)- y(x)/ln(x)/x^2;
ode≔y''=y⁢x+y⁢ln⁡x⁢x2+y'⁢ln⁡x⁢x2⁢ⅇxln⁡x⁢x2−yln⁡x⁢x2
This ODE has the following adjoint
DEtools[adjoint](ode, y(x));
−ⅇx⁢x−1⁢yln⁡x⁢x2+ⅇx⁢y'+y''
This adjoint equation is in turn solvable by dsolve
dsolve((15));
Methods for second order ODEs: --- Trying classification methods --- trying a symmetry of the form [xi=0, eta=F(x)] <- BRANCH 2 successful. Symmetry is:, [0, exp(Int(1/x/ln(x),x))] <- linear_1 successful
y=∫ⅇ−ⅇxln⁡x2ⅆx⁢c__1+c__2⁢ln⁡x
Now the solutions to the adjoint equation are integrating factors of the original LODE, so the two independent solutions implied in the general solution above
eval(rhs((16)), {_C1=0, _C2=1});
ln⁡x
eval(rhs((16)), {_C1=1, _C2=2});
∫ⅇ−ⅇxln⁡x2ⅆx+2⁢ln⁡x
are integrating factors of ode. These integrating factors could also be found using the intfactor directly
Mu := intfactor(ode);
trying a symmetry of the form [xi=0, eta=F(x)]<- linear_1 successful Trying an integrating factor as the solution to the adjoint linear ODE trying a symmetry of the form [xi=0, eta=F(x)] <- linear_1 successful
The integrating factors are: ,ln⁡x,∫ⅇ−ⅇxln⁡x2ⅆx⁢ln⁡x
Μ≔ln⁡x,∫ⅇ−ⅇxln⁡x2ⅆx⁢ln⁡x
Constructing solutions using integrating factors
How are these integrating factors transformed into a solution to the original problem? By using them to construct two first integrals; that is: two ODEs of lower order (in this case two first order ODEs). For that purpose it is provided the firint command which receives an exact ODE and returns a first integral. The idea is simple: an exact ODE is a total derivative - say dR/dx; firint returns the R + _C1:
firint(Mu[1]*ode);
−ln⁡x⁢x2⁢ⅇx+x⁢yx2+ln⁡x⁢y'+c__1=0
firint(Mu[2]*ode);
−∫ⅇ−ⅇxln⁡x2ⅆx⁢ln⁡x2⁢ⅇx⁢x2+∫ⅇ−ⅇxln⁡x2ⅆx⁢ln⁡x⁢x+ⅇ−ⅇx⁢x2⁢yln⁡x⁢x2+∫ⅇ−ⅇxln⁡x2ⅆx⁢ln⁡x⁢y'+c__1=0
Eliminating y' from these two first integrals (and replacing _C1 by _C2 in one of them) leads to the solution f⁡x,y,c__1,c__2=0 to this ode. So all this process could be ran interactively, as shown, or in one step
dsolve(ode);
Methods for second order ODEs: --- Trying classification methods --- trying a symmetry of the form [xi=0, eta=F(x)] checking if the LODE is missing 'y' -> Heun: Equivalence to the GHE or one of its 4 confluent cases under 'a power @ Moebius' -> trying a solution of the form r0(x) * Y + r1(x) * Y' where Y = exp(int(r(x), dx)) * 2F1([a1, a2], [b1], f) -> Trying changes of variables to rationalize or make the ODE simpler trying a symmetry of the form [xi=0, eta=F(x)] checking if the LODE is missing 'y' -> Heun: Equivalence to the GHE or one of its 4 confluent cases under 'a power @ Moebius' -> trying a solution of the form r0(x) * Y + r1(x) * Y' where Y = exp(int(r(x), dx)) * 2F1([a1, a2], [b1], f) -> Tackling the "Normal Form" of the given linear ODE: trying a symmetry of the form [xi=0, eta=F(x)] -> Tackling the linear ODE using alternative approaches: trying 2nd order exact linear trying symmetries linear in x and y(x) trying to convert to a linear ODE with constant coefficients testing BRANCH 1 -> trying a symmetry of the form [xi=0, eta=F(x)] checking if the LODE is missing 'y' -> Heun: Equivalence to the GHE or one of its 4 confluent cases under 'a power @ Moebius' -> trying a solution of the form r0(x) * Y + r1(x) * Y' where Y = exp(int(r(x), dx)) * 2F1([a1, a2], [b1], f) -> Tackling the "Normal Form" of the given linear ODE: trying a symmetry of the form [xi=0, eta=F(x)] -> Tackling the linear ODE using alternative approaches: trying 2nd order exact linear trying symmetries linear in x and y(x) trying to convert to a linear ODE with constant coefficients testing BRANCH 1 -> <- unable to find a useful change of variables -> Tackling the "Normal Form" of the given linear ODE: trying a symmetry of the form [xi=0, eta=F(x)] -> Tackling the linear ODE using alternative approaches: trying 2nd order exact linear trying symmetries linear in x and y(x) trying to convert to a linear ODE with constant coefficients testing BRANCH 1 -> trying 2nd order, integrating factor of the form mu(x,y) <- 2nd order, integrating factors of the form mu(x,y) successful
y=c__1⁢ⅇⅇx⁢ln⁡x+c__2⁢ⅇⅇx⁢∫ⅇ−ⅇxln⁡x2ⅆx⁢ln⁡x
Integrating factors for second and higher order nonlinear ODEs
There are algorithms in dsolve for determining integrating factors for nonlinear ODEs too:
for second order ODEs, integrating factors depending on two variables (x, y) or (x, y') or (y, y') - when they exist - can be systematically determined;
for third order ODEs, integrating factors depending only on (y'') can also be systematically determined.
infolevel[dsolve] := 0; # Turn OFF userinfos for dsolve
infoleveldsolve≔0
ode := diff(y(x), x, x, x) = -diff(y(x), x, x)^2/diff(y(x), x);
ode≔y'''=−y''2y'
For this ODE, three integrating factors are
intfactor((24));
y',y'⁢x,1y''
The product of any of them times the ode is a total derivative, from where a first integral can be obtained; for instance taking the third one
firint((25)[3] * ode);
ln⁡y'+ln⁡y''+c__1=0
Solving for y'' this reduced ODE,
isolate((26), diff(y(x), x, x));
y''=1y'⁢ⅇc__1
we are able to calculate more integrating factors (in this case intfactor succeeds again):
intfactor((27));
y'
and obtain a lower order first integral as in the previous step
firint((28) * ((27)));
y'2−2⁢xⅇc__1+c__2=0
Finally, this is a simple first order ODE which can be solved directly, leading to the general solution for the original ode problem:
dsolve((29));
y=−c__2⁢ⅇc__1−2⁢x⁢−ⅇc__1⁢c__2⁢ⅇc__1−2⁢x3⁢ⅇc__1+c__3,y=c__2⁢ⅇc__1−2⁢x⁢−ⅇc__1⁢c__2⁢ⅇc__1−2⁢x3⁢ⅇc__1+c__3
map(odetest, [(30)], ode);
0,0
where in above we map the odetest command over each of the solutions. As a general comment, the integration constants entering the general solution of an ODE are arbitrary, we can always rename ⅇ_C1→_C1, simplifying a bit the solution. This ode here solved using the integrating factor approach can also be solved using the symmetry approach (following the steps shown in the next section).
Also interesting in the integrating factor approach is the inverse problem; that is: to determine the most general ODE family having a given integrating factor (related worked examples are found in redode).
dsolve includes symmetry methods for all differential order. The possibility of using separate tool-commands related to each of the symmetry steps makes approaching the method relatively easy. In addition, the possibility of also classifying the ODE according to standard methods, or looking for related integrating factors permits observing the natural relation existing among all these approaches. The most relevant related commands are symgen, canoni, transinv, reduce_order and buildsol; see also DEtools, Lie and dsolve, Lie.
The following worked example aims at illustrating how the solving process can be performed step-by-step, using the symmetry approach, and with instructions easy to re-use. The commands to be used are: symgen (for calculating the symmetries), reduce_order (for reducing the order using these symmetries), and buildsol (to build the solution to the original problem from the solutions to the reduced ODE problems)
This is a fifth order ODE (from Kamke's book, high order ODE example 17):
ode5 := 9*diff(y(x), x, x)^2*diff(y(x), x, x, x, x, x) - 45*diff(y(x), x, x)*diff(y(x), x, x, x)*diff(y(x), x, x, x, x) + 40*diff(y(x), x, x, x)=0;
ode5≔9⁢y''2⁢y'''''−45⁢y''⁢y'''⁢y''''+40⁢y'''=0
Classifying using odeadvisor (classifying ODEs is now a menu option available when "right clicking" on the ODE above)
odeadvisor(ode5);
_high_order,_missing_x,_high_order,_missing_y,_high_order,_with_linear_symmetries
it is apparent that there are various possible departure points to start reducing the ODE order: the ODE is missing the dependent and independent variables, it also has linear symmetries. In connection with all these starting points there are the symmetries:
X5 := symgen(ode5);
X5≔_ξ=0,_η=1,_ξ=1,_η=0,_ξ=0,_η=x,_ξ=1,_η=x,_ξ=x3,_η=y
The result above means, basically, that dsolve is able to solve the ODE by itself. With the purpose of illustrating the method, these symmetries are used below interactively to solve the ODE. The simplest manner of doing that is: reduce the order of the ODE by one and restart the discussion around this reduced ODE. When this approach is successful, build the solution to the original problem from the solution to the last reduced ODE. The steps below can be re-used with others ODE examples, as for instance the one solved interactively in the previous section by using integrating factors.
So we start reducing the order using just one of the symmetries above
OFF; # Turn OFF the enhanced DEdisplay feature
R_5_to_4 := reduce_order(ode5, X5[1], u(t));
R_5_to_4≔y⁡x=∫u⁡tⅆt+c__1whereⅆ4ⅆt4u⁡t=5⁢ⅆ2ⅆt2u⁡t⁢ⅆ3ⅆt3u⁡tⅆⅆtu⁡t−40⁢ⅆ2ⅆt2u⁡t9⁢ⅆⅆtu⁡t2,t=x,u⁡t=ⅆⅆxy⁡x,x=t,y⁡x=∫u⁡tⅆt+c__1
The structure of the solution above contains the answer in terms of a new function, u(t), which satisfy the fourth order differential equation being shown.
Now select this fourth order ODE and consider the same cycle again (finding symmetries plus reducing its order again):
ode4 := op([2, 2, 1, 1], R_5_to_4);
ode4≔ⅆ4ⅆt4u⁡t=5⁢ⅆ2ⅆt2u⁡t⁢ⅆ3ⅆt3u⁡tⅆⅆtu⁡t−40⁢ⅆ2ⅆt2u⁡t9⁢ⅆⅆtu⁡t2
X4 := symgen(ode4);
X4≔_ξ=0,_η=1,_ξ=1,_η=0,_ξ=1,_η=1,_ξ=t2,_η=u
With the symmetries of ode4 in hands we can proceed in the same way to obtain a reduction of order from 4 to 3, now expressing the third order differential equation in terms of a new function s(r)
R_4_to_3 := reduce_order(ode4, X4[1], s(r));
R_4_to_3≔u⁡t=∫s⁡rⅆr+c__1whereⅆ3ⅆr3s⁡r=5⁢ⅆⅆrs⁡r⁢ⅆ2ⅆr2s⁡rs⁡r−40⁢ⅆⅆrs⁡r9⁢s⁡r2,r=t,s⁡r=ⅆⅆtu⁡t,t=r,u⁡t=∫s⁡rⅆr+c__1
Selecting the third order ODE and calculating its symmetries leads to
ode3 := op([2, 2, 1, 1], R_4_to_3);
ode3≔ⅆ3ⅆr3s⁡r=5⁢ⅆⅆrs⁡r⁢ⅆ2ⅆr2s⁡rs⁡r−40⁢ⅆⅆrs⁡r9⁢s⁡r2
X3 := symgen(ode3);
X3≔_ξ=1,_η=0,_ξ=r,_η=s
These symmetries can be used to reduced the order further, obtaining a second order ODE - we choose z(v) as new unknown function:
R_3_to_2 := reduce_order(ode3, X3[1], z(v));
R_3_to_2≔s⁡r=vwhereⅆ2ⅆv2z⁡v=3⁢ⅆⅆvz⁡v2z⁡v+40⁢z⁡v39⁢v2+5⁢ⅆⅆvz⁡vv,v=s⁡r,z⁡v=1ⅆⅆrs⁡r,r=∫z⁡vⅆv+c__1,s⁡r=v
ode2 := op([2, 2, 1, 1], R_3_to_2);
ode2≔ⅆ2ⅆv2z⁡v=3⁢ⅆⅆvz⁡v2z⁡v+40⁢z⁡v39⁢v2+5⁢ⅆⅆvz⁡vv
One more cycle reduce the problem to a first order linear ODE which is a problem having solution in the general case in terms of integrals
X2 := symgen(ode2);
X2≔_ξ=0,_η=z3,_ξ=v,_η=0
R_2_to_1 := reduce_order(ode2, X2[1], a(b));
R_2_to_1≔z⁡v=−12⁢∫a⁡bⅆb+c__1whereⅆⅆba⁡b=5⁢a⁡bb+409⁢b2,b=v,a⁡b=ⅆⅆvz⁡vz⁡v3,v=b,z⁡v=−12⁢∫a⁡bⅆb+c__1
ode1 := op([2, 2, 1, 1], R_2_to_1);
ode1≔ⅆⅆba⁡b=5⁢a⁡bb+409⁢b2
The answer to this easy ODE found at the end of the reduction process is
sol1 := dsolve(ode1);
sol1≔a⁡b=−2027⁢b6+c__1⁢b5
Now, how could we build the solution to the original fifth order ode5? As follows: first use this solution above to build the solution to ode2 (the second order ODE one step above and rename integration constants which appeared as _C1 in all reductions):
buildsol(subs(_C1=_C2, R_2_to_1), sol1);
z⁡v=−12⁢∫v5⁢c__1−2027⁢vⅆv+c__2
The integral can be evaluated via
sol2 := value((47));
sol2≔z⁡v=−12⁢−20⁢ln⁡v27+c__1⁢v66+c__2
And now repeat the process until arriving at the solution to the original fifth order ode
sol3 := buildsol(subs(_C1=_C3, R_3_to_2), sol2);
sol3≔s⁡r=RootOf⁡−r+3⁢3⁢∫` `_Z−19⁢c__1⁢_a6−40⁢ln⁡_a+54⁢c__2ⅆ_a+c__3
sol4 := buildsol(subs(_C1=_C4, R_4_to_3), sol3);
sol4≔u⁡t=∫RootOf⁡−t+3⁢3⁢∫` `_Z−19⁢c__1⁢_a6−40⁢ln⁡_a+54⁢c__2ⅆ_a+c__3ⅆt+c__4
sol5 := buildsol(subs(_C1=_C5, R_5_to_4), sol4);
sol5≔y⁡x=∫∫RootOf⁡−x+3⁢3⁢∫` `_Z−19⁢c__1⁢_a6−40⁢ln⁡_a+54⁢c__2ⅆ_a+c__3ⅆx+c__4ⅆx+c__5
This result can be tested using odetest
odetest(sol5, ode5);
0
For more examples see dsolve, Lie, , reduce_order and the help pages linked from DEtools, Lie.
Also interesting in the symmetry approach is the inverse problem; that is: to determine the most general ODE family having given symmetries (see equinv), or the symmetries of an 'unknown' ODE when its solution is given (see buildsym). Combining these two tools it is possible to depart from the form of the solution and arrive at the most general ODE problem having the symmetries of that type of solution (examples are found in the mentioned help-pages).
In addition to the general solution, Nonlinear ODEs may also have singular solutions (see references). When the ODE is polynomial in the unknown function y(x) and its derivatives, these singular solutions can be obtained separately by first splitting the ODE problem into cases. For example, consider
ON; # Turn ON the enhanced DEdisplay
ode := (y(x)*diff(y(x), x, x)-diff(y(x), x)^2)*diff(y(x), x, x, x, x)-diff(y(x), x, x)^3 -y(x)*diff(y(x), x, x, x)^2+2*diff(y(x), x)*diff(y(x), x, x)*diff(y(x), x, x, x);
ode≔y⁢y''−y'2⁢y''''−y''3−y⁢y'''2+2⁢y'⁢y''⁢y'''
The set of general and singular solutions to this ODE is given by the union of the non-singular solutions to each of the following ODEs:
casesplit(ode);
y''''=y⁢y'''2−2⁢y'⁢y''⁢y'''+y''3y⁢y''−y'2wherey⁢y''−y'2≠0,y''=y'2ywherey≠0,y=0where
In above we see three cases. The first one, which has the same differential order of the original problem ode leads to the general solution. The two second cases are of lower differential order and lead to singular solutions. So for this example dsolve returns
In some cases (e.g.: the one above) some of the singular solutions can be obtained by adjusting the integration constants in the other solutions (general or singular).
See Also
odeadvisor
dsolve, formal_series
dsolve, ICs
dsolve, inttrans
dsolve, Lie
dsolve, linear
dsolve, numeric
dsolve, piecewise
dsolve, series
dsolve, system
infolevel
DEtools
PDEtools
Download Help Document