Integrating factors for second order ODEs

A symbolic algorithm for the maxima CAS.

In this manual you will find how to use ode2_lie to find an integrating factor, a lambda symmetry or a first integral of a second order ODE. This method is based on the paper of Cheb-terrab and Roche [1]. The link between integrating factors and lambda symmetries comes from the paper of Muriel and Romero [2].

step 1: loading the files


In [ ]:
kill(all);batch("~/mathematics/maxima_files/ode2_lie.mac");batch("~/mathematics/maxima_files/kamke6_1.mac");

To test our implementation, we use the database of second order nonlinear ordinary differential equations found in the book of Kamke [3]. These ODEs are defined in chapter 6, and provided as a list in the file kamke6_1.mac

The code is rather new and therefore produces some intermediate messages to let you know what's going on. To show only warning and error messages, we lower the message verbosity to 1:


In [2]:
DEBUGFLAG:1;


Out[2]:
\[\tag{${\it \%o}_{27}$}1\]

A value of 0 shows only error messages, a value of 1 additionally shows warning messages, and values 2..5 show increasingly more messages and intermediate results to help you figure out what is going on.

example 1

Since ode2_lie is based on the paper of Cheb-terrab and Roche [1], we will first show that it produces the same results as the examples in the paper. The first ODE we will test is kamke ode 6.226, which has an integrating factor of the form $\mu(x,y')$:


In [3]:
ode226: kamke6[226];


Out[3]:
\[\tag{${\it \%o}_{28}$}\frac{d}{d\,x}\,y\,\left(\frac{d^2}{d\,x^2}\,y\right)-x^2\,y\,\left(\frac{d}{d\,x}\,y\right)-x\,y^2\]

In [4]:
mu:ode2_lie(ode226,y,x);


Out[4]:
\[\tag{${\it \%o}_{29}$}\frac{d}{d\,x}\,y\]

The ODE was already in exact form, so the integrating factor $y'$ was detected immediately to be the coefficient of the highest derivative by testing for exactness. We now check if the integratingfactor is correct:


In [5]:
isIntegratingFactor(mu,ode226,y,x);


Out[5]:
\[\tag{${\it \%o}_{30}$}\mathbf{true}\]

example 2

now we are going to solve the ode $\frac{dy}{dx}=\frac{h(y')}{x-y}$, which is kamke ode 6.136. This is another example of an ODE with an integrating factor of the form $\mu(x,y')$:


In [6]:
ode136: kamke6[136];


Out[6]:
\[\tag{${\it \%o}_{31}$}\left(x-y\right)\,\left(\frac{d^2}{d\,x^2}\,y\right)-h\left(\frac{d}{d\,x}\,y\right)\]

we can compute an integrating factor using the command ode2_lie(ode,y,x), where $y=y(x)$ is the dependent variable and $x$ is the independent variable. Note that we do not need to define explicit dependencies.


In [7]:
mu:ode2_lie(ode136,y,x);


Out[7]:
\[\tag{${\it \%o}_{32}$}\frac{\frac{d}{d\,x}\,y-1}{h\left(\frac{d}{d\,x}\,y\right)}\]

we check if the integrating factor is correct:


In [8]:
isIntegratingFactor(mu,ode136,y,x);


Out[8]:
\[\tag{${\it \%o}_{33}$}\mathbf{true}\]

example 3

Another ODE with an integrating factor of the form $\mu(x,y')$ is Kamke ode 6.66:


In [9]:
ode66:kamke6[66];


Out[9]:
\[\tag{${\it \%o}_{34}$}\frac{d^2}{d\,x^2}\,y-a\,\left(y+b\,x+c\right)\,\left(\left(\frac{d}{d\,x}\,y\right)^2+1\right)^{\frac{3}{2}}\]

In [11]:
mu:ode2_lie(ode66,y,x);


Out[11]:
\[\tag{${\it \%o}_{36}$}\frac{\frac{d}{d\,x}\,y+b}{a\,\left(\left(\frac{d}{d\,x}\,y\right)^2+1\right)^{\frac{3}{2}}}\]

In [12]:
isIntegratingFactor(mu,ode66,y,x);


Out[12]:
\[\tag{${\it \%o}_{37}$}\mathbf{true}\]

example 4

This example is not in the Kamke database:


In [13]:
ode: 'diff(y,x,2)=('diff(y,x)*(x*'diff(y,x)+1)*(-2+exp(y)))/('diff(y,x)*x^2+'diff(y,x)-1);


Out[13]:
\[\tag{${\it \%o}_{38}$}\frac{d^2}{d\,x^2}\,y=\frac{\left(e^{y}-2\right)\,\left(\frac{d}{d\,x}\,y\right)\,\left(x\,\left(\frac{d}{d\,x}\,y\right)+1\right)}{x^2\,\left(\frac{d}{d\,x}\,y\right)+\frac{d}{d\,x}\,y-1}\]

In [14]:
mu: ode2_lie(ode,y,x);


Out[14]:
\[\tag{${\it \%o}_{39}$}\frac{x^2\,\left(\frac{d}{d\,x}\,y\right)+\frac{d}{d\,x}\,y-1}{\frac{d}{d\,x}\,y}\]

Note that this result is different from the paper. We check if the integrating factor is correct:


In [15]:
isIntegratingFactor(mu,ode,y,x);


Out[15]:
\[\tag{${\it \%o}_{40}$}\mathbf{true}\]

It seems that in the paper, the first term in the intermediate expression of eq. (2.90) has a wrong sign: $(y'-\frac{1}{x})$ should be $(y'+\frac{1}{x})$ and the term cancels with the denominater of the second term in (2.90).

Integrating factors of the form $\mu(y,y')$

An ODE having an integrating factor of the form $\mu(y,y')$ is the following ODE:


In [16]:
ode: 'diff(y,x,2)-'diff(y,x)^2/y + sin(x)*'diff(y,x)*y + cos(x)*y^2=0;


Out[16]:
\[\tag{${\it \%o}_{41}$}\frac{d^2}{d\,x^2}\,y-\frac{\left(\frac{d}{d\,x}\,y\right)^2}{y}+\sin x\,y\,\left(\frac{d}{d\,x}\,y\right)+\cos x\,y^2=0\]

It turns out that when a change of variables $y(x)\rightarrow x, x\rightarrow y(x)$ is applied to an ODE with $\mu(y,y')$ as integrating factor, the transformed ODE has an integrating factor of the form $\mu(x,1/y')/y'^2$. These changes of variables are carried out automatically by ode2_lie in the search for symmetries. In the following example, maxima asks a question during the search. We provide the answer beforehand by defining an assumption first:


In [17]:
assume(y^4>4*'diff(y,x)^2);


Out[17]:
\[\tag{${\it \%o}_{42}$}\left[ y^4-4\,\left(\frac{d}{d\,x}\,y\right)^2>0 \right] \]

In [18]:
mu:ode2_lie(ode,y,x);


Out[18]:
\[\tag{${\it \%o}_{43}$}\frac{1}{y}\]

The paper also gives a first integral for this ODE, which we can compute as well:


In [19]:
I:firstIntegral(ode,y,x);


Out[19]:
\[\tag{${\it \%o}_{44}$}\frac{\frac{d}{d\,x}\,y+\sin x\,y^2}{y}+{\it \%c}_{0}\]

We can check if the first integral is correct by testing it against the ode. The ode was first made exact by multiplying with the integrating factor:


In [20]:
isFirstIntegral(I,ratexpand(mu*(lhs(ode)-rhs(ode))),y,x);


Out[20]:
\[\tag{${\it \%o}_{45}$}\mathbf{true}\]

It is interesting to note that integrating factors are directly related to $\lambda$-symmetries, see [2]. We can compute the $\lambda$-symmetry from the integrating factor:


In [21]:
L:lambdaSymmetry(ode,mu,y,x);


Out[21]:
\[\tag{${\it \%o}_{46}$}-\frac{\sin x\,y^2-\frac{d}{d\,x}\,y}{y}\]

In [22]:
isLambdaSymmetry(L,ode,y,x);


Out[22]:
\[\tag{${\it \%o}_{47}$}\mathbf{true}\]

second order ODE admitting an integrating factor

We can compute the general second order ODE that admits a certain integrating factor $\mu$. For instance, the general ODE that admits an integrating factor of the form $\mu=\mu(x,y)$ is given by:


In [23]:
odeconstruct(m(x,y),y,x);


Out[23]:
\[\tag{${\it \%o}_{48}$}\frac{d^2}{d\,x^2}\,y=-\frac{\frac{d}{d\,y}\,m\left(x , y\right)\,\left(\frac{d}{d\,x}\,y\right)^2+\left(\frac{d}{d\,x}\,m\left(x , y\right)+\frac{d}{d\,y}\,{\it \%F}\left(x , y\right)\right)\,\left(\frac{d}{d\,x}\,y\right)+\frac{d}{d\,x}\,{\it \%F}\left(x , y\right)}{m\left(x , y\right)}\]

Here we recognize the ODE eq. (2.13) given in [1].

This concludes the tutorial for ode2_lie.

bibliography

[1] E.S. Cheb-terrab and A.D. Roche, Integrating Factors for Second-order ODEs, J. Symbolic Computation 27 (1999) https://arxiv.org/abs/math-ph/0002025

[2] C. Muriel and J.L. Romero, First integrals, integrating factors and lambda-symmetries of second order differential equations, J. Phys. A: Math Theor. 42 (2009)

[3] E. Kamke, Differentialgleichungen, L$\ddot o$sungsmethoden und L$\ddot o$sungen, Leipzig, 1959