81.5.9 problem 9

Internal problem ID [18672]
Book : A short course on differential equations. By Donald Francis Campbell. Maxmillan company. London. 1907
Section : Chapter IV. Ordinary linear differential equations with constant coefficients. Exercises at page 58
Problem number : 9
Date solved : Tuesday, January 28, 2025 at 12:09:10 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Solution by Maple

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

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

Solution by Mathematica

Time used: 0.021 (sec). Leaf size: 28

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