The redode command is interesting mainly as a tool for generating solving schemes for given ODE families; we illustrate this with two examples.
>
|
|
1. Consider the second order ODE family having an integrating factor -- an arbitrary function -- such that the reduced ODE has the same integrating factor. We want to set up an algorithm such that, given a second order linear ODE,
>
|
|
| (3) |
where there are no restrictions on , or , the scheme determines if the ODE belongs to the family just described, and if so it also determines . The knowledge of is enough to completely solve the given ODE.
To start with, we obtain the general first order ODE having as integrating factor using:
>
|
|
| (4) |
where is an arbitrary function. To obtain the second order ODE mentioned above, we pass ode_1 as an argument (playing the role of the reduced ODE) with the integrating factor to obtain:
>
|
|
| (5) |
Taking this general ODE pattern as our starting point, we set up the required solving scheme by comparing coefficients in ode_2 and ode_psi obtaining the following expressions.
>
|
|
| (6) |
>
|
|
| (7) |
By solving , we get as:
>
|
|
| (8) |
and by substituting this result into the second one we get the pattern identifying the ODE family.
>
|
|
| (9) |
2. Consider the second order ODE family having an integrating factor -- an arbitrary function -- and the symmetry (see infgen), and such that the reduced ODE is the most general first order linear ODE:
>
|
|
| (10) |
where A(x) and B(x) are arbitrary functions. To start with, we obtain the second order ODE mentioned above which has the integrating factor as in example 1.
>
|
|
| (11) |
In the previous step, ode_2 is in fact the most general second order linear ODE we can imagine. If we now impose the symmetry condition (see odepde), where , we arrive at the following restriction on .
>
|
|
| (12) |
We can solve this ODE for .
>
|
|
| (13) |
Introducing the result into ode_2 and disregarding the nonhomogeneous term (irrelevant in the solving scheme), we obtain the homogeneous ODE family pattern:
>
|
|
| (14) |
>
|
|
| (15) |
where we have set the constant equal to 1 without loss of generality ( is defined up to a constant factor). To set up a solving scheme here, check if the coefficient of in a given ODE is related to the coefficient of as in the equation above, in which case the integrating factor is just .
3. Consider the following three integrating factors of some (unknown) third order ODE:
>
|
|
| (16) |
The most general third order ODE simultaneously admitting all these integrating factors depends on an arbitrary function of and can be computed as follows.
>
|
|
| (17) |
>
|
|
| (18) |
The test performed above verifies - returning zero - that the given integrating factors (the list mu) indeed turn the returned ODE exact - see mutest.
The number of given integrating factors can be different than the differential order. For example, taking just the first two integrating factors of the previous example, the most general third order ODE turned exact by them actually depends - in addition - on an arbitrary function of two variables, .
>
|
|
| (19) |
>
|
|
| (20) |
>
|
|
| (21) |