Internal problem ID [12808]
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).
ODE order: 2.
ODE degree: 1.
CAS Maple gives this as type [[_2nd_order, _linear, _nonhomogeneous]]
\[ \boxed {y^{\prime \prime }-y^{\prime }-2 y=\left \{\begin {array}{cc} 1 & 2\le x <4 \\ 0 & \operatorname {otherwise} \end {array}\right .} \] With initial conditions \begin {align*} [y \left (0\right ) = 0, y^{\prime }\left (0\right ) = 1] \end {align*}
✓ Solution by Maple
Time used: 8.969 (sec). Leaf size: 136
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 \left (x \right ) = \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}^{2-x}+\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}^{4-x}+{\mathrm e}^{2-x}-\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.068 (sec). Leaf size: 127
DSolve[{y''[x]-y'[x]-2*y[x]==Piecewise[{ {1,2<=x<4},{0,True}}],{y[0]==0,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} \]