2.38 problem 37

2.38.1 Solved as second order Bessel ode
2.38.2 Maple step by step solution
2.38.3 Maple trace
2.38.4 Maple dsolve solution
2.38.5 Mathematica DSolve solution

Internal problem ID [7822]
Book : Own collection of miscellaneous problems
Section : section 2.0
Problem number : 37
Date solved : Monday, October 21, 2024 at 04:22:32 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

Solve

\begin{align*} y^{\prime \prime }-x^{2} y-x^{4}+2&=0 \end{align*}

2.38.1 Solved as second order Bessel ode

Time used: 0.617 (sec)

Writing the ode as

\begin{align*} x^{2} y^{\prime \prime }-x^{4} y = x^{2} \left (x^{4}-2\right )\tag {1} \end{align*}

Let the solution be

\begin{align*} y &= y_h + y_p \end{align*}

Where \(y_h\) is the solution to the homogeneous ODE and \(y_p\) is a particular solution to the non-homogeneous ODE. Bessel ode has the form

\begin{align*} x^{2} y^{\prime \prime }+y^{\prime } x +\left (-n^{2}+x^{2}\right ) y = 0\tag {2} \end{align*}

The generalized form of Bessel ode is given by Bowman (1958) as the following

\begin{align*} x^{2} y^{\prime \prime }+\left (1-2 \alpha \right ) x y^{\prime }+\left (\beta ^{2} \gamma ^{2} x^{2 \gamma }-n^{2} \gamma ^{2}+\alpha ^{2}\right ) y = 0\tag {3} \end{align*}

With the standard solution

\begin{align*} y&=x^{\alpha } \left (c_1 \operatorname {BesselJ}\left (n , \beta \,x^{\gamma }\right )+c_2 \operatorname {BesselY}\left (n , \beta \,x^{\gamma }\right )\right )\tag {4} \end{align*}

Comparing (3) to (1) and solving for \(\alpha ,\beta ,n,\gamma \) gives

\begin{align*} \alpha &= {\frac {1}{2}}\\ \beta &= \frac {i}{2}\\ n &= {\frac {1}{4}}\\ \gamma &= 2 \end{align*}

Substituting all the above into (4) gives the solution as

\begin{align*} y = c_1 \sqrt {x}\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )+c_2 \sqrt {x}\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \end{align*}

Therefore the homogeneous solution \(y_h\) is

\[ y_h = c_1 \sqrt {x}\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )+c_2 \sqrt {x}\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \]

The particular solution \(y_p\) can be found using either the method of undetermined coefficients, or the method of variation of parameters. The method of variation of parameters will be used as it is more general and can be used when the coefficients of the ODE depend on \(x\) as well. Let

\begin{equation} \tag{1} y_p(x) = u_1 y_1 + u_2 y_2 \end{equation}

Where \(u_1,u_2\) to be determined, and \(y_1,y_2\) are the two basis solutions (the two linearly independent solutions of the homogeneous ODE) found earlier when solving the homogeneous ODE as

\begin{align*} y_1 &= \sqrt {x}\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \\ y_2 &= \sqrt {x}\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \\ \end{align*}

In the Variation of parameters \(u_1,u_2\) are found using

\begin{align*} \tag{2} u_1 &= -\int \frac {y_2 f(x)}{a W(x)} \\ \tag{3} u_2 &= \int \frac {y_1 f(x)}{a W(x)} \\ \end{align*}

Where \(W(x)\) is the Wronskian and \(a\) is the coefficient in front of \(y''\) in the given ODE. The Wronskian is given by \(W= \begin {vmatrix} y_1 & y_{2} \\ y_{1}^{\prime } & y_{2}^{\prime } \end {vmatrix} \). Hence

\[ W = \begin {vmatrix} \sqrt {x}\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) & \sqrt {x}\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \\ \frac {d}{dx}\left (\sqrt {x}\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )\right ) & \frac {d}{dx}\left (\sqrt {x}\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )\right ) \end {vmatrix} \]

Which gives

\[ W = \begin {vmatrix} \sqrt {x}\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) & \sqrt {x}\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \\ \frac {\operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )}{2 \sqrt {x}}+i x^{{3}/{2}} \left (-\operatorname {BesselJ}\left (\frac {5}{4}, \frac {i x^{2}}{2}\right )-\frac {i \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )}{2 x^{2}}\right ) & \frac {\operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )}{2 \sqrt {x}}+i x^{{3}/{2}} \left (-\operatorname {BesselY}\left (\frac {5}{4}, \frac {i x^{2}}{2}\right )-\frac {i \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )}{2 x^{2}}\right ) \end {vmatrix} \]

Therefore

\[ W = \left (\sqrt {x}\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )\right )\left (\frac {\operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )}{2 \sqrt {x}}+i x^{{3}/{2}} \left (-\operatorname {BesselY}\left (\frac {5}{4}, \frac {i x^{2}}{2}\right )-\frac {i \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )}{2 x^{2}}\right )\right ) - \left (\sqrt {x}\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )\right )\left (\frac {\operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )}{2 \sqrt {x}}+i x^{{3}/{2}} \left (-\operatorname {BesselJ}\left (\frac {5}{4}, \frac {i x^{2}}{2}\right )-\frac {i \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )}{2 x^{2}}\right )\right ) \]

Which simplifies to

\[ W = -i x^{2} \left (\operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \operatorname {BesselY}\left (\frac {5}{4}, \frac {i x^{2}}{2}\right )-\operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \operatorname {BesselJ}\left (\frac {5}{4}, \frac {i x^{2}}{2}\right )\right ) \]

Which simplifies to

\[ W = \frac {4}{\pi } \]

Therefore Eq. (2) becomes

\[ u_1 = -\int \frac {x^{{5}/{2}} \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \left (x^{4}-2\right )}{\frac {4 x^{2}}{\pi }}\,dx \]

Which simplifies to

\[ u_1 = - \int \frac {\sqrt {x}\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \left (x^{4}-2\right ) \pi }{4}d x \]

Hence

\[ u_1 = -\left (\int _{0}^{x}\frac {\sqrt {\alpha }\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i \alpha ^{2}}{2}\right ) \left (\alpha ^{4}-2\right ) \pi }{4}d \alpha \right ) \]

And Eq. (3) becomes

\[ u_2 = \int \frac {x^{{5}/{2}} \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \left (x^{4}-2\right )}{\frac {4 x^{2}}{\pi }}\,dx \]

Which simplifies to

\[ u_2 = \int \frac {\sqrt {x}\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \left (x^{4}-2\right ) \pi }{4}d x \]

Hence

\[ u_2 = \int _{0}^{x}\frac {\sqrt {\alpha }\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i \alpha ^{2}}{2}\right ) \left (\alpha ^{4}-2\right ) \pi }{4}d \alpha \]

Therefore the particular solution, from equation (1) is

\[ y_p(x) = -\left (\int _{0}^{x}\frac {\sqrt {\alpha }\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i \alpha ^{2}}{2}\right ) \left (\alpha ^{4}-2\right ) \pi }{4}d \alpha \right ) \sqrt {x}\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )+\sqrt {x}\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \left (\int _{0}^{x}\frac {\sqrt {\alpha }\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i \alpha ^{2}}{2}\right ) \left (\alpha ^{4}-2\right ) \pi }{4}d \alpha \right ) \]

Which simplifies to

\[ y_p(x) = -\frac {\sqrt {x}\, \pi \left (\left (\int _{0}^{x}\sqrt {\alpha }\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i \alpha ^{2}}{2}\right ) \left (\alpha ^{4}-2\right )d \alpha \right ) \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )-\operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \left (\int _{0}^{x}\sqrt {\alpha }\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i \alpha ^{2}}{2}\right ) \left (\alpha ^{4}-2\right )d \alpha \right )\right )}{4} \]

Therefore the general solution is

\begin{align*} y &= y_h + y_p \\ &= \left (c_1 \sqrt {x}\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )+c_2 \sqrt {x}\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )\right ) + \left (-\frac {\sqrt {x}\, \pi \left (\left (\int _{0}^{x}\sqrt {\alpha }\, \operatorname {BesselY}\left (\frac {1}{4}, \frac {i \alpha ^{2}}{2}\right ) \left (\alpha ^{4}-2\right )d \alpha \right ) \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right )-\operatorname {BesselY}\left (\frac {1}{4}, \frac {i x^{2}}{2}\right ) \left (\int _{0}^{x}\sqrt {\alpha }\, \operatorname {BesselJ}\left (\frac {1}{4}, \frac {i \alpha ^{2}}{2}\right ) \left (\alpha ^{4}-2\right )d \alpha \right )\right )}{4}\right ) \\ \end{align*}

Will add steps showing solving for IC soon.

2.38.2 Maple step by step solution

2.38.3 Maple trace
Methods for second order ODEs:
 
2.38.4 Maple dsolve solution

Solving time : 0.005 (sec)
Leaf size : 34

dsolve(diff(diff(y(x),x),x)-x^2*y(x)-x^4+2 = 0, 
       y(x),singsol=all)
 
\[ y = \sqrt {x}\, \operatorname {BesselI}\left (\frac {1}{4}, \frac {x^{2}}{2}\right ) c_2 +\sqrt {x}\, \operatorname {BesselK}\left (\frac {1}{4}, \frac {x^{2}}{2}\right ) c_1 -x^{2} \]
2.38.5 Mathematica DSolve solution

Solving time : 6.382 (sec)
Leaf size : 217

DSolve[{D[y[x],{x,2}]-x^2*y[x]-x^4+2==0,{}}, 
       y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \operatorname {ParabolicCylinderD}\left (-\frac {1}{2},\sqrt {2} x\right ) \left (\int _1^x-\frac {\left (K[1]^4-2\right ) \operatorname {ParabolicCylinderD}\left (-\frac {1}{2},i \sqrt {2} K[1]\right )}{\sqrt {2} \left (\operatorname {HermiteH}\left (-\frac {1}{2},i K[1]\right ) \operatorname {HermiteH}\left (\frac {1}{2},K[1]\right )+\operatorname {HermiteH}\left (-\frac {1}{2},K[1]\right ) \left (-i \operatorname {HermiteH}\left (\frac {1}{2},i K[1]\right )-2 \operatorname {HermiteH}\left (-\frac {1}{2},i K[1]\right ) K[1]\right )\right )}dK[1]+c_1\right )+\operatorname {ParabolicCylinderD}\left (-\frac {1}{2},i \sqrt {2} x\right ) \left (\int _1^x\frac {\left (K[2]^4-2\right ) \operatorname {ParabolicCylinderD}\left (-\frac {1}{2},\sqrt {2} K[2]\right )}{\sqrt {2} \left (\operatorname {HermiteH}\left (-\frac {1}{2},i K[2]\right ) \operatorname {HermiteH}\left (\frac {1}{2},K[2]\right )+\operatorname {HermiteH}\left (-\frac {1}{2},K[2]\right ) \left (-i \operatorname {HermiteH}\left (\frac {1}{2},i K[2]\right )-2 \operatorname {HermiteH}\left (-\frac {1}{2},i K[2]\right ) K[2]\right )\right )}dK[2]+c_2\right ) \]