ode internal name "exact_linear_second_order_ode"
Given the ode
We want to first find the condition for exactness. This is the same as saying the above ode has a corresponding adjoint ode, which is \(\left ( py^{\prime }+B\left ( x\right ) y\right ) ^{\prime }=0\). i.e. if an ode \(p\left ( x\right ) y^{\prime \prime }+q\left ( x\right ) y^{\prime }+r\left ( x\right ) y=0\) can be written in the form \(\left ( py^{\prime }+B\left ( x\right ) y\right ) ^{\prime }=0\) for some \(B\left ( x\right ) \) then the ode \(\left ( py^{\prime }+By\right ) ^{\prime }=0\) is called the adjoint of \(py^{\prime \prime }+qy^{\prime }+ry=0\) which is the same thing as saying the ode \(p\left ( x\right ) y^{\prime \prime }+q\left ( x\right ) y^{\prime }+r\left ( x\right ) y=0\) is exact. i.e. it has complete differential.
The goal therefore is to determine if a linear second order ode has a corresponding adjoint ODE or not of the form \(\left ( py^{\prime }+B\left ( x\right ) y\right ) ^{\prime }=0\). If so, then it is exact and we can solve it by solving the adjoint ODE instead since it is much simpler to solve as it is a first order ODE. Lets see how to find the adjoint ODE.
Let
Expanding gives
Comparing coefficients
Differentiating the first ode gives \(q^{\prime }=p^{\prime \prime }+B^{\prime }\). Using the second ode gives \(q^{\prime }=p^{\prime \prime }+r\) or
This is the condition for exactness. i.e. if the input ODE (1) satisfies (2) then the ODE is exact and has an adjoint ODE of the form \(\left ( py^{\prime }+By\right ) ^{\prime }=0\) which we now can be easily solve since it is complete differential.
We see that solving (3) is much simpler than (1) since (3) is first order. Integrating this once gives
This is first order ode. This is also called the first integral equation of (1). In summary, given an ode \(py^{\prime \prime }+qy^{\prime }+ry=0\) which is exact, then its first integral is \(py^{\prime }+\left ( q-p^{\prime }\right ) y=c\) and the solution to this is the solution to the original second order ode.
Then \(p=x^{2},q=x,r=-1,f\left ( x\right ) =x^{4}\). Condition (2) becomes
Hence it is second order exact. Therefore the adjoint ode (3) is
The first integral is
This is linear ode. Solving this ode gives
Note that this is also a Euler ode.
Here \(p=1,q=x,r=1.\) Let \(F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) =y^{\prime \prime }+xy^{\prime }+y\). The condition for exactness is
Hence the above becomes
The ode is already exact. i.e. no integrating factor is needed. The solution becomes
The first integral is
Solving this gives