2.1007   ODE No. 1007

  1. Problem in Latex
  2. Mathematica input
  3. Maple input

\[ -4 e^{x^2} x^2+y''(x)-2 y(x)=0 \] Mathematica : cpu = 0.0736958 (sec), leaf count = 36

\[\left \{\left \{y(x)\to c_1 e^{\sqrt {2} x}+c_2 e^{-\sqrt {2} x}+e^{x^2}\right \}\right \}\]

Maple : cpu = 0.054 (sec), leaf count = 26

\[ \left \{ y \left ( x \right ) ={{\rm e}^{\sqrt {2}x}}{\it \_C2}+{{\rm e}^{-\sqrt {2}x}}{\it \_C1}+{{\rm e}^{{x}^{2}}} \right \} \]

Hand solution

\begin {equation} y^{\prime \prime }-2y=4x^{2}e^{x^{2}}\tag {1} \end {equation} We start by solving the homogeneous equation \[ y^{\prime \prime }-2y=0 \] Let \(y=e^{\lambda x}\), substitution in above gives\begin {align*} \lambda ^{2}e^{\lambda x}-2e^{\lambda x} & =0\\ \lambda ^{2}-2 & =0 \end {align*}

Hence \(\lambda =\pm \sqrt {2}\), therefore the solution is\begin {align*} y_{h} & =Ae^{\sqrt {2}x}+Be^{\sqrt [-]{2}x}\\ & =Ay_{1}+By_{2} \end {align*}

Now we solve for the particular solution using variation of parameters.

\[ y_{p}=u_{1}y_{1}+u_{2}y_{2}\]

wronskian is

\[ W=\begin {vmatrix} y_{1} & y_{2}\\ y_{1}^{\prime } & y_{2}^{\prime }\end {vmatrix} =\begin {vmatrix} e^{\sqrt {2}x} & e^{\sqrt [-]{2}x}\\ \sqrt {2}e^{\sqrt {2}x} & -\sqrt {2}e^{-\sqrt {2}x}\end {vmatrix} =-\sqrt {2}-\sqrt {2}=-2\sqrt {2}\]

Hence, using \(f=4x^{2}e^{x^{2}}\), which is the RHS of the ODE, and noting that \(a_{0}\) is the coefficient of \(y^{\prime \prime }\) which is one here, then

\begin {align*} u_{1} & =\int \frac {-y_{2}}{W}\frac {f}{a_{0}}dx=-\int \frac {e^{\sqrt [-]{2}x}}{-2\sqrt {2}}4x^{2}e^{x^{2}}dx\\ & =\frac {2}{\sqrt {2}}\int x^{2}e^{x^{2}\sqrt [-]{2}x}dx\\ & =\frac {2}{\sqrt {2}}\left ( \frac {1}{4}e^{x\left ( x-\sqrt {2}\right ) }\left ( \sqrt {2}+2x\right ) \right ) \end {align*}

And

\begin {align*} u_{2} & =\int \frac {y_{1}}{W}\frac {f}{a_{0}}dx=\int \frac {e^{\sqrt {2}x}}{-2\sqrt {2}}4x^{2}e^{x^{2}}dx\\ & =\frac {-2}{\sqrt {2}}\int x^{2}e^{x^{2}\sqrt [+]{2}x}dx\\ & =\frac {-2}{\sqrt {2}}\left ( -\frac {1}{4}e^{x\left ( x+\sqrt {2}\right ) }\left ( \sqrt {2}-2x\right ) \right ) \end {align*}

Since \(y_{p}=u_{1}e^{\sqrt {2}x}+u_{2}e^{\sqrt [-]{2}x}\) then\begin {align*} y_{p} & =\frac {2}{\sqrt {2}}\left ( \frac {1}{4}e^{x\left ( x-\sqrt {2}\right ) }\left ( \sqrt {2}+2x\right ) \right ) e^{\sqrt {2}x}-\frac {2}{\sqrt {2}}\left ( -\frac {1}{4}e^{x\left ( x+\sqrt {2}\right ) }\left ( \sqrt {2}-2x\right ) \right ) e^{\sqrt [-]{2}x}\\ & =\frac {2}{\sqrt {2}}\frac {1}{4}e^{x^{2}}\left ( \sqrt {2}+2x\right ) +\frac {2}{\sqrt {2}}\frac {1}{4}e^{x^{2}}\left ( \sqrt {2}-2x\right ) \\ & =\frac {1}{2}e^{x^{2}}+\frac {1}{2}e^{x^{2}}\\ & =e^{x^{2}} \end {align*}

Therefore, the full solution is \begin {align*} y & =y_{h}+y_{p}\\ & =Ae^{\sqrt {2}x}+Be^{\sqrt [-]{2}x}+e^{x^{2}} \end {align*}

restart; 
ode:=diff(y(x),x$2)-2*y(x)=4*x^2*exp(x^2); 
y0:=_C1*exp(sqrt(2)*x)+_C2*exp(-sqrt(2)*x)+exp(x^2); 
odetest(y(x)=y0,ode); 
0