85.58.3 problem 3

Internal problem ID [22841]
Book : Applied Differential Equations. By Murray R. Spiegel. 3rd edition. 1980. Pearson. ISBN 978-0130400970
Section : Chapter 4. Linear differential equations. C Exercises at page 200
Problem number : 3
Date solved : Thursday, October 02, 2025 at 09:15:39 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y&=x^{2} \cos \left (5 x \right ) \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 35
ode:=diff(diff(y(x),x),x)+y(x) = x^2*cos(5*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (x \right ) c_2 +\cos \left (x \right ) c_1 -\frac {x^{2} \cos \left (5 x \right )}{24}+\frac {19 \cos \left (5 x \right )}{1728}+\frac {5 \sin \left (5 x \right ) x}{144} \]
Mathematica. Time used: 0.014 (sec). Leaf size: 40
ode=D[y[x],{x,2}]+y[x]==x^2*Cos[5*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {\left (19-72 x^2\right ) \cos (5 x)+60 x \sin (5 x)}{1728}+c_1 \cos (x)+c_2 \sin (x) \end{align*}
Sympy. Time used: 0.089 (sec). Leaf size: 41
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2*cos(5*x) + y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (x \right )} + C_{2} \cos {\left (x \right )} - \frac {x^{2} \cos {\left (5 x \right )}}{24} + \frac {5 x \sin {\left (5 x \right )}}{144} + \frac {19 \cos {\left (5 x \right )}}{1728} \]