71.15.2 problem 4 (b)

Internal problem ID [14544]
Book : Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section : Chapter 5. The Laplace Transform Method. Exercises 5.4, page 265
Problem number : 4 (b)
Date solved : Tuesday, January 28, 2025 at 06:43:11 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-y^{\prime }-2 y&=\left \{\begin {array}{cc} 1 & 2\le x <4 \\ 0 & \operatorname {otherwise} \end {array}\right . \end{align*}

Using Laplace method With initial conditions

\begin{align*} y \left (0\right )&=0\\ y^{\prime }\left (0\right )&=1 \end{align*}

Solution by Maple

Time used: 16.301 (sec). Leaf size: 128

dsolve([diff(y(x),x$2)-diff(y(x),x)-2*y(x)=piecewise(2<=x and x<4,1,true,0),y(0) = 0, D(y)(0) = 1],y(x), singsol=all)
 
\[ y = \frac {\left (\left \{\begin {array}{cc} -{\mathrm e}^{-x}+{\mathrm e}^{2 x} & x <2 \\ -\frac {1}{2}-{\mathrm e}^{-2}+{\mathrm e}^{4} & x =2 \\ -{\mathrm e}^{-x}+{\mathrm e}^{2 x}-\frac {3}{2}+{\mathrm e}^{-x +2}+\frac {{\mathrm e}^{2 x -4}}{2} & x <4 \\ \frac {\left (2 \,{\mathrm e}^{12}+{\mathrm e}^{8}-2 \,{\mathrm e}^{4}+2 \,{\mathrm e}^{2}-2\right ) {\mathrm e}^{-4}}{2} & x =4 \\ -{\mathrm e}^{-x}+{\mathrm e}^{2 x}-{\mathrm e}^{-x +4}+{\mathrm e}^{-x +2}-\frac {{\mathrm e}^{2 x -8}}{2}+\frac {{\mathrm e}^{2 x -4}}{2} & 4<x \end {array}\right .\right )}{3} \]

Solution by Mathematica

Time used: 0.041 (sec). Leaf size: 127

DSolve[{D[y[x],{x,2}]-D[y[x],x]-2*y[x]==Piecewise[{ {1,2<=x<4},{0,True}}],{y[0]==0,Derivative[1][y][0] ==1}},y[x],x,IncludeSingularSolutions -> True]
 
\[ y(x)\to \begin {array}{cc} \{ & \begin {array}{cc} \frac {1}{3} e^{-x} \left (-1+e^{3 x}\right ) & x\leq 2 \\ \frac {1}{6} e^{-x-4} \left (-2 e^4+2 e^6+e^{3 x}-3 e^{x+4}+2 e^{3 x+4}\right ) & 2<x\leq 4 \\ \frac {1}{6} e^{-x-8} \left (-2 e^8+2 e^{10}-2 e^{12}-e^{3 x}+e^{3 x+4}+2 e^{3 x+8}\right ) & \text {True} \\ \end {array} \\ \end {array} \]