DEtools
firint
calculate first integrals for exact ODEs
Calling Sequence
Parameters
Description
Examples
firint(ODE, y(x), _mu = .., basis = [.., ...], method = formal)
ODE
-
an ODE that is either linear, or exact, or otherwise an integrating factor for it shall also be indicated using the _mu = ... option
y(x)
(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
with⁡DEtools:
L_ODE≔diff⁡y⁡x,x=A⁡x⁢y⁡x+B⁡x
L_ODE≔ⅆⅆxy⁡x=A⁡x⁢y⁡x+B⁡x
Μ≔intfactor⁡L_ODE
Μ≔ⅇ∫−A⁡xⅆx
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)
firint⁡Μ⁢L_ODE
ⅇ∫−A⁡xⅆx⁢y⁡x−∫ⅇ−∫A⁡xⅆx⁢B⁡xⅆx+_C1=0
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
reducible_ODE≔ⅆⅆxy⁡x=−ⅆⅆxμ⁡x⁢y⁡x+_F1⁡xμ⁡x
An exact nonlinear ODE which also has integrating factors of the form μ⁡x,y
ode2≔x⁢y⁡x⁢diff⁡y⁡x,x,x+x⁢diff⁡y⁡x,x2+a⁢y⁡x⁢diff⁡y⁡x,x+f⁡x
ode2≔x⁢y⁡x⁢ⅆ2ⅆx2y⁡x+x⁢ⅆⅆxy⁡x2+a⁢y⁡x⁢ⅆⅆxy⁡x+f⁡x
odeadvisor⁡ode2
_2nd_order,_exact,_nonlinear,_2nd_order,_reducible,_mu_xy
Two integrating factors and the related first integrals
μ≔intfactor⁡ode2
μ≔1,xax
firint⁡ode2
y⁡x2⁢a−12+x⁢ⅆⅆxy⁡x⁢y⁡x+∫f⁡xⅆx+_C1=0
firint⁡μ2⁢ode2
xa⁢y⁡x⁢ⅆⅆxy⁡x+∫xa⁢f⁡xxⅆx+_C1=0
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:
dsolve⁡ode2,mu_xy
y⁡x=2⁢a−1⁢x1−a⁢∫xa⁢f⁡xxⅆx+x1−a⁢c__1−∫f⁡xⅆx−c__2a−1,y⁡x=−2⁢a−1⁢x1−a⁢∫xa⁢f⁡xxⅆx+x1−a⁢c__1−∫f⁡xⅆx−c__2a−1
A third order ODE, an integrating factor for it, and the related first integral.
ode3≔diff⁡y⁡x,x,x,x=−2⁢diff⁡y⁡x,x2−y⁡x⁢diff⁡y⁡x,x,xdiff⁡y⁡x,x2⁢exp⁡diff⁡y⁡x,x,x
ode3≔ⅆ3ⅆx3y⁡x=−2⁢ⅆⅆxy⁡x2−y⁡x⁢ⅆ2ⅆx2y⁡xⅆⅆxy⁡x2⁢ⅇⅆ2ⅆx2y⁡x
Μ≔intfactor⁡ode3
Μ≔ⅇⅆ2ⅆx2y⁡x
firint⁡Μ⁢ode3
y⁡xⅆⅆxy⁡x+ⅇⅆ2ⅆx2y⁡x+x+c__1=0
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≔diff⁡y⁡x,x,x=−6⁢x−6x⁢3⁢x+2⁢diff⁡y⁡x,x+6x⁢3⁢x+2⁢y⁡x−6x⁢3⁢x+2
ode4≔ⅆ2ⅆx2y⁡x=−6⁢x−6⁢ⅆⅆxy⁡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
firint⁡ode4,method=formal
−ⅆⅆxy⁡x⁢x−ⅆⅆxy⁡x+y⁡x−1⁢x33⁢x+2,ⅆⅆxy⁡x⁢x+2⁢y⁡x−23⁢x+2
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
PDEtoolsdeclare⁡y⁡x,g⁡x,prime=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
Basis≔g1,g2,g0
ode5≔diff⁡y⁡x,x,x=diff⁡g1⁡x,x,x⁢g2⁡x−g1⁡x⁢diff⁡g2⁡x,x,xg2⁡x⁢diff⁡g1⁡x,x−g1⁡x⁢diff⁡g2⁡x,x⁢diff⁡y⁡x,x+diff⁡g1⁡x,x⁢diff⁡g2⁡x,x,x−diff⁡g1⁡x,x,x⁢diff⁡g2⁡x,xg2⁡x⁢diff⁡g1⁡x,x−g1⁡x⁢diff⁡g2⁡x,x⁢y⁡x+−diff⁡g2⁡x,x,x⁢g0⁡x⁢diff⁡g1⁡x,x+g2⁡x⁢diff⁡g0⁡x,x,x⁢diff⁡g1⁡x,x−diff⁡g0⁡x,x,x⁢g1⁡x⁢diff⁡g2⁡x,x+diff⁡g2⁡x,x⁢g0⁡x⁢diff⁡g1⁡x,x,x−g2⁡x⁢diff⁡g0⁡x,x⁢diff⁡g1⁡x,x,x+diff⁡g0⁡x,x⁢g1⁡x⁢diff⁡g2⁡x,x,xg2⁡x⁢diff⁡g1⁡x,x−g1⁡x⁢diff⁡g2⁡x,x
ode5≔y''=g1''⁢g2−g1⁢g2''⁢y'g2⁢g1 '−g1⁢g2 '+g1 '⁢g2''−g1''⁢g2 '⁢yg2⁢g1 '−g1⁢g2 '+−g2''⁢g0⁢g1 '+g2⁢g0''⁢g1 '−g0''⁢g1⁢g2 '+g2 '⁢g0⁢g1''−g2⁢g0 '⁢g1''+g0 '⁢g1⁢g2''g2⁢g1 '−g1⁢g2 '
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
sol5≔y=c__1⁢g1+c__1⁢g2+g0
odetest⁡sol5,ode5
0
A complete set of first integrals for ode5 computed from Basis
firint⁡ode5,y⁡x,basis=Basis
y−g0⁢g2 '−g2⁢y'−g0 'g1⁢g2 '−g2⁢g1 ',−y+g0⁢g1 '+g1⁢y'−g0 'g1⁢g2 '−g2⁢g1 '
Verify this result
map⁡firtest,,ode5,y⁡x
0,0
See Also
DEtools[firtest]
DEtools[intfactor]
DEtools[redode]
dsolve
PDEtools
PDEtools[declare]
Download Help Document