72.9.6 problem 4 (c)

Internal problem ID [19540]
Book : DIFFERENTIAL EQUATIONS WITH APPLICATIONS AND HISTORICAL NOTES by George F. Simmons. 3rd edition. 2017. CRC press, Boca Raton FL.
Section : Chapter 3. Second order linear equations. Section 14. Introduction. Problems at page 112
Problem number : 4 (c)
Date solved : Thursday, October 02, 2025 at 04:39:55 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-2 y&=\sin \left (x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 26
ode:=diff(diff(y(x),x),x)-2*y(x) = sin(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{\sqrt {2}\, x} c_2 +{\mathrm e}^{-\sqrt {2}\, x} c_1 -\frac {\sin \left (x \right )}{3} \]
Mathematica. Time used: 0.068 (sec). Leaf size: 37
ode=D[y[x],{x,2}] -2* y[x]==Sin[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\frac {\sin (x)}{3}+c_1 e^{\sqrt {2} x}+c_2 e^{-\sqrt {2} x} \end{align*}
Sympy. Time used: 0.047 (sec). Leaf size: 27
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*y(x) - sin(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- \sqrt {2} x} + C_{2} e^{\sqrt {2} x} - \frac {\sin {\left (x \right )}}{3} \]