23.2.19 problem 6(h)

Internal problem ID [4136]
Book : Theory and solutions of Ordinary Differential equations, Donald Greenspan, 1960
Section : Chapter 3. Linear differential equations of second order. Exercises at page 31
Problem number : 6(h)
Date solved : Monday, January 27, 2025 at 08:38:29 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Solution by Maple

Time used: 0.003 (sec). Leaf size: 25

dsolve(diff(y(x),x$2)+y(x)=sin(x),y(x), singsol=all)
 
\[ y \left (x \right ) = \frac {\left (2 c_{1} -x \right ) \cos \left (x \right )}{2}+\frac {\sin \left (x \right ) \left (2 c_{2} +1\right )}{2} \]

Solution by Mathematica

Time used: 0.024 (sec). Leaf size: 22

DSolve[D[y[x],{x,2}]+y[x]==Sin[x],y[x],x,IncludeSingularSolutions -> True]
 
\[ y(x)\to \left (-\frac {x}{2}+c_1\right ) \cos (x)+c_2 \sin (x) \]