2.2.2 problem 2

Solved as second nonlinear ode solved by Mainardi Lioville method
Maple step by step solution
Maple trace
Maple dsolve solution
Mathematica DSolve solution

Internal problem ID [8537]
Book : Second order enumerated odes
Section : section 2
Problem number : 2
Date solved : Sunday, November 10, 2024 at 04:00:57 AM
CAS classification : [_Liouville, [_2nd_order, _reducible, _mu_xy]]

Solve

\begin{align*} y^{\prime \prime }+\sin \left (x \right ) y^{\prime }+y {y^{\prime }}^{2}&=0 \end{align*}

Solved as second nonlinear ode solved by Mainardi Lioville method

Time used: 0.243 (sec)

The ode has the Liouville form given by

\begin{align*} y^{\prime \prime }+ f(x) y^{\prime } + g(y) {y^{\prime }}^{2} &= 0 \tag {1A} \end{align*}

Where in this problem

\begin{align*} f(x) &= \sin \left (x \right )\\ g(y) &= y \end{align*}

Dividing through by \(y^{\prime }\) then Eq (1A) becomes

\begin{align*} \frac {y^{\prime \prime }}{y^{\prime }}+ f + g y^{\prime } &= 0 \tag {2A} \end{align*}

But the first term in Eq (2A) can be written as

\begin{align*} \frac {y^{\prime \prime }}{y^{\prime }}&= \frac {d}{dx} \ln \left ( y^{\prime } \right )\tag {3A} \end{align*}

And the last term in Eq (2A) can be written as

\begin{align*} g \frac {dy}{dx}&= \left ( \frac {d}{dy} \int g d y\right ) \frac {dy}{dx} \\ &= \frac {d}{dx} \int g d y\tag {4A} \end{align*}

Substituting (3A,4A) back into (2A) gives

\begin{align*} \frac {d}{dx} \ln \left ( y^{\prime } \right ) + \frac {d}{dx} \int g d y &= -f \tag {5A} \end{align*}

Integrating the above w.r.t. \(x\) gives

\begin{align*} \ln \left ( y^{\prime } \right ) + \int g d y &= - \int f d x + c_1 \end{align*}

Where \(c_1\) is arbitrary constant. Taking the exponential of the above gives

\begin{align*} y^{\prime } &= c_2 e^{\int -g d y}\, e^{\int -f d x}\tag {6A} \end{align*}

Where \(c_2\) is a new arbitrary constant. But since \(g=y\) and \(f=\sin \left (x \right )\), then

\begin{align*} \int -g d y &= \int -y d y\\ &= -\frac {y^{2}}{2}\\ \int -f d x &= \int -\sin \left (x \right )d x\\ &= \cos \left (x \right ) \end{align*}

Substituting the above into Eq(6A) gives

\[ y^{\prime } = c_2 \,{\mathrm e}^{-\frac {y^{2}}{2}} {\mathrm e}^{\cos \left (x \right )} \]

Which is now solved as first order separable ode. The ode \(y^{\prime } = c_2 \,{\mathrm e}^{-\frac {y^{2}}{2}} {\mathrm e}^{\cos \left (x \right )}\) is separable as it can be written as

\begin{align*} y^{\prime }&= c_2 \,{\mathrm e}^{-\frac {y^{2}}{2}} {\mathrm e}^{\cos \left (x \right )}\\ &= f(x) g(y) \end{align*}

Where

\begin{align*} f(x) &= {\mathrm e}^{\cos \left (x \right )} c_2\\ g(y) &= {\mathrm e}^{-\frac {y^{2}}{2}} \end{align*}

Integrating gives

\begin{align*} \int { \frac {1}{g(y)} \,dy} &= \int { f(x) \,dx}\\ \int { {\mathrm e}^{\frac {y^{2}}{2}}\,dy} &= \int { {\mathrm e}^{\cos \left (x \right )} c_2 \,dx}\\ -\frac {i \sqrt {\pi }\, \sqrt {2}\, \operatorname {erf}\left (\frac {i \sqrt {2}\, y}{2}\right )}{2}&=\int {\mathrm e}^{\cos \left (x \right )} c_2 d x +2 c_3 \end{align*}

Will add steps showing solving for IC soon.

Summary of solutions found

\begin{align*} -\frac {i \sqrt {\pi }\, \sqrt {2}\, \operatorname {erf}\left (\frac {i \sqrt {2}\, y}{2}\right )}{2} &= \int {\mathrm e}^{\cos \left (x \right )} c_2 d x +2 c_3 \\ \end{align*}

Maple step by step solution

Maple trace
`Methods for second order ODEs: 
--- Trying classification methods --- 
trying 2nd order Liouville 
<- 2nd_order Liouville successful`
 
Maple dsolve solution

Solving time : 0.011 (sec)
Leaf size : 35

dsolve(diff(diff(y(x),x),x)+sin(x)*diff(y(x),x)+y(x)*diff(y(x),x)^2 = 0, 
       y(x),singsol=all)
 
\[ y = -i \operatorname {RootOf}\left (i \sqrt {2}\, c_{1} \left (\int {\mathrm e}^{\cos \left (x \right )}d x \right )+i \sqrt {2}\, c_{2} -\operatorname {erf}\left (\textit {\_Z} \right ) \sqrt {\pi }\right ) \sqrt {2} \]
Mathematica DSolve solution

Solving time : 0.433 (sec)
Leaf size : 47

DSolve[{D[y[x],{x,2}]+Sin[x]*D[y[x],x]+y[x]*(D[y[x],x])^2==0,{}}, 
       y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -i \sqrt {2} \text {erf}^{-1}\left (i \sqrt {\frac {2}{\pi }} \left (\int _1^x-e^{\cos (K[1])} c_1dK[1]+c_2\right )\right ) \]