62.27.1 problem Ex 1

Internal problem ID [12939]
Book : An elementary treatise on differential equations by Abraham Cohen. DC heath publishers. 1906
Section : Chapter VII, Linear differential equations with constant coefficients. Article 50. Method of undetermined coefficients. Page 107
Problem number : Ex 1
Date solved : Tuesday, January 28, 2025 at 04:44:31 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Solution by Maple

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

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

Solution by Mathematica

Time used: 0.300 (sec). Leaf size: 77

DSolve[D[y[x],{x,2}]+4*y[x]==x^2+Cos[x],y[x],x,IncludeSingularSolutions -> True]
 
\[ y(x)\to \cos (2 x) \int _1^x-\cos (K[1]) \left (K[1]^2+\cos (K[1])\right ) \sin (K[1])dK[1]+\sin (2 x) \int _1^x\frac {1}{2} \cos (2 K[2]) \left (K[2]^2+\cos (K[2])\right )dK[2]+c_1 \cos (2 x)+c_2 \sin (2 x) \]