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 := diff(y(x),x)=A(x)*y(x)+B(x);
Mu := 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(mu(x),y(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),x)^2+a*y(x)*diff(y(x),x)+f(x);
odeadvisor(ode2); # ODE is in exact form, and has mu(x,y)
Two integrating factors and the related first integrals
mu := 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 := diff(y(x),x,x,x) = - (2*diff(y(x),x)^2 - y(x)*diff(y(x),x,x))/diff(y(x),x)^2/exp(diff(y(x),x,x));
Mu := 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 := diff(y(x),x,x) = (-6*x-6)/x/(3*x+2)*diff(y(x),x)+6/x/(3*x+2)*y(x)-6/x/(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);
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
PDEtools[declare](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 := [[g(x), g(x)], g(x)];
ode5 := diff(y(x),x,x) = (diff(g(x),x,x)*g(x)-g(x)*diff(g(x),x,x))/(g(x)*diff(g(x),x)-g(x)*diff(g(x),x))*diff(y(x),x)+(diff(g(x),x)*diff(g(x),x,x)-diff(g(x),x,x)*diff(g(x),x))/(g(x)*diff(g(x),x)-g(x)*diff(g(x),x))*y(x)+(-diff(g(x),x,x)*g(x)*diff(g(x),x)+g(x)*diff(g(x),x,x)*diff(g(x),x)-diff(g(x),x,x)*g(x)*diff(g(x),x)+diff(g(x),x)*g(x)*diff(g(x),x,x)-g(x)*diff(g(x),x)*diff(g(x),x,x)+diff(g(x),x)*g(x)*diff(g(x),x,x))/(g(x)*diff(g(x),x)-g(x)*diff(g(x),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*g(x) + _C1*g(x) + g(x);
A complete set of first integrals for ode5 computed from Basis
firint(ode5, y(x), basis = Basis);
Verify this result
map(firtest, [(21)], ode5, y(x));
Download Help Document
What kind of issue would you like to report? (Optional)