50.14.14 problem 2(f)

Internal problem ID [8052]
Book : Differential Equations: Theory, Technique, and Practice by George Simmons, Steven Krantz. McGraw-Hill NY. 2007. 1st Edition.
Section : Chapter 2. Problems for Review and Discovery. Drill excercises. Page 105
Problem number : 2(f)
Date solved : Monday, January 27, 2025 at 03:39:56 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-y&=\cos \left (x \right ) \end{align*}

With initial conditions

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

Solution by Maple

Time used: 0.928 (sec). Leaf size: 57

dsolve([diff(y(x),x$2)-y(x)=cos(x),y(0) = 3, D(y)(2) = 2],y(x), singsol=all)
 
\[ y = \frac {\left (\sin \left (2\right )-4\right ) {\mathrm e}^{-x +2}+7 \,{\mathrm e}^{-x +4}+\left (-\sin \left (2\right )+4\right ) {\mathrm e}^{x +2}+\left (-{\mathrm e}^{4}-1\right ) \cos \left (x \right )+7 \,{\mathrm e}^{x}}{2 \,{\mathrm e}^{4}+2} \]

Solution by Mathematica

Time used: 0.031 (sec). Leaf size: 67

DSolve[{D[y[x],{x,2}]-y[x]==Cos[x],{y[0]==3,Derivative[1][y][2]==2}},y[x],x,IncludeSingularSolutions -> True]
 
\[ y(x)\to \frac {e^{-x} \left (7 e^{2 x}-e^{2 x+2} (\sin (2)-4)+\left (1+e^4\right ) \left (-e^x\right ) \cos (x)+7 e^4+e^2 (\sin (2)-4)\right )}{2 \left (1+e^4\right )} \]