85.56.8 problem 2 (b)

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

\begin{align*} 4 y+y^{\prime \prime }&=x^{2}+3 x \cos \left (2 x \right ) \end{align*}
Maple. Time used: 0.004 (sec). Leaf size: 40
ode:=diff(diff(y(x),x),x)+4*y(x) = x^2+3*x*cos(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {1}{8}+\frac {\left (24 x^{2}+64 c_2 -3\right ) \sin \left (2 x \right )}{64}+\frac {\left (3 x +16 c_1 \right ) \cos \left (2 x \right )}{16}+\frac {x^{2}}{4} \]
Mathematica. Time used: 0.159 (sec). Leaf size: 46
ode=D[y[x],{x,2}]+4*y[x]==x^2+3*x*Cos[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {1}{64} \left (16 x^2+\left (24 x^2-3+64 c_2\right ) \sin (2 x)+4 (3 x+16 c_1) \cos (2 x)-8\right ) \end{align*}
Sympy. Time used: 0.118 (sec). Leaf size: 36
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 - 3*x*cos(2*x) + 4*y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {x^{2}}{4} + \left (C_{1} + \frac {3 x}{16}\right ) \cos {\left (2 x \right )} + \left (C_{2} + \frac {3 x^{2}}{8}\right ) \sin {\left (2 x \right )} - \frac {1}{8} \]