calculate first integrals for exact ODEs
firint(ODE, y(x), _mu = .., basis = [.., ...], method = formal)
an ODE that is either linear, or exact, or otherwise an integrating factor for it shall also be indicated using the _mu = ... option
(optional) required if the exact_ODE contains derivatives of more than one function
_mu = ..
(optional) to indicate an integrating factor for ODE when it is not exact
method = formal
(optional) only for linear ODEs, to request the computation of a complete set of first integrals
basis = [...]
(optional) only for linear ODEs, a basis of solutions for ODE, to be used to compute a complete set of first integrals
The firint command receives an nth order ODE, that could be: 1) linear or nonlinear but in exact form, that is, satisfying ODE=dRdx, 2) not in exact form but an integrating factor for it is indicated using the option _mu = ..., 3) the ODE is linear together with the option method = formal. The output of firint for these problems consists of a related first integral (the ODE R, of order n−1, in ODE=dRdx), or a complete set of them in case 3). The dependent variable y(x), is required only when the ODE contains derivatives of more than one function. Typically, the given ODE is exact; for calculating integrating factors to use with the option _mu = ... see intfactor.
The optional arguments can be given alone or in conjunction, and in any order.
When a linear ODE is given and the option method = formal is indicated, firint attempts computing a complete basis of solutions for the ODE, or uses a given one if passed with the optional argument basis = [...], and from it computes a complete set of first integrals, that is as many as the differential order and all independent from each other.
This function is part of the DEtools package, and so it can be used in the form firint(..) only after executing the command with(DEtools). However, it can always be accessed through the long form of the command by using DEtools[firint](..).
Nonlinear and linear ODEs
The general first order linear ODE and its integrating factor
L_ODE ≔ ⅆⅆx⁢y⁡x=A⁡x⁢y⁡x+B⁡x
Μ ≔ intfactor⁡L_ODE
A related first integral can now be obtained either using the option _μ=Μ, as in: firint(L_ODE, _mu = Mu), or multiplying directly L_ODE by Mu (by construction, Mu*L_ODE is exact)
The most general first order ODE reducible by an integrating factor depending only on x is a Linear ODE (see redode):
reducible_ODE ≔ redode⁡μ⁡x,y⁡x
An exact nonlinear ODE which also has integrating factors of the form μ⁡x,y
ode2 ≔ x⁢y⁡x⁢ⅆ2ⅆx2⁢y⁡x+x⁢ⅆⅆx⁢y⁡x2+a⁢y⁡x⁢ⅆⅆx⁢y⁡x+f⁡x
Two integrating factors and the related first integrals
μ ≔ intfactor⁡ode2
The answer to ode2 can be built from these two first integrals interactively, or by calling dsolve with extra arguments, indicating the use of the integrating factor scheme mu_xy:
A third order ODE, an integrating factor for it, and the related first integral.
ode3 ≔ ⅆ3ⅆx3⁢y⁡x=−2⁢ⅆⅆx⁢y⁡x2−y⁡x⁢ⅆ2ⅆx2⁢y⁡xⅆⅆx⁢y⁡x2⁢ⅇⅆ2ⅆx2⁢y⁡x
Μ ≔ intfactor⁡ode3
Linear ODEs and method = formal
The firint command treats linear and nonlinear ODEs in equal footing, unless the optional method = formal, valid only for linear equations, is indicated. Consider
ode4 ≔ ⅆ2ⅆx2⁢y⁡x=−6⁢x−6⁢ⅆⅆx⁢y⁡xx⁢3⁢x+2+6⁢y⁡xx⁢3⁢x+2−6x⁢3⁢x+2
Calling firint without optional arguments will result in an error message telling ode4 is not exact. Passing method = formal, you instead get a complete set of independent first integrals obtained by first computing a basis of the solution space
A textbook example: the most general 2nd order non-homogeneous linear ODE having for solution basis g1⁡x and g2⁡x, for the homogeneous part, and g0⁡x as particular solution of the whole non-homogeneous equation, so the basis of solutions is g1⁡x,g2⁡x,g0⁡x
y⁡x⁢will now be displayed as⁢y
g⁡x⁢will now be displayed as⁢g
derivatives with respect to⁢x⁢of functions of one variable will now be displayed with '
Basis ≔ g1⁡x,g2⁡x,g0⁡x
ode5 ≔ ⅆ2ⅆx2⁢y⁡x=ⅆ2ⅆx2⁢g1⁡x⁢g2⁡x−g1⁡x⁢ⅆ2ⅆx2⁢g2⁡x⁢ⅆⅆx⁢y⁡xg2⁡x⁢ⅆⅆx⁢g1⁡x−g1⁡x⁢ⅆⅆx⁢g2⁡x+ⅆⅆx⁢g1⁡x⁢ⅆ2ⅆx2⁢g2⁡x−ⅆ2ⅆx2⁢g1⁡x⁢ⅆⅆx⁢g2⁡x⁢y⁡xg2⁡x⁢ⅆⅆx⁢g1⁡x−g1⁡x⁢ⅆⅆx⁢g2⁡x+−ⅆ2ⅆx2⁢g2⁡x⁢g0⁡x⁢ⅆⅆx⁢g1⁡x+g2⁡x⁢ⅆ2ⅆx2⁢g0⁡x⁢ⅆⅆx⁢g1⁡x−ⅆ2ⅆx2⁢g0⁡x⁢g1⁡x⁢ⅆⅆx⁢g2⁡x+ⅆⅆx⁢g2⁡x⁢g0⁡x⁢ⅆ2ⅆx2⁢g1⁡x−g2⁡x⁢ⅆⅆx⁢g0⁡x⁢ⅆ2ⅆx2⁢g1⁡x+ⅆⅆx⁢g0⁡x⁢g1⁡x⁢ⅆ2ⅆx2⁢g2⁡xg2⁡x⁢ⅆⅆx⁢g1⁡x−g1⁡x⁢ⅆⅆx⁢g2⁡x
Verify that Basis is a complete basis for the solutions of ode5: from Basis construct the general solution then test it using odetest
sol5 ≔ y⁡x=_C1⁢g1⁡x+_C1⁢g2⁡x+g0⁡x
A complete set of first integrals for ode5 computed from Basis
Verify this result
Download Help Document
What kind of issue would you like to report? (Optional)