58.11.22 problem 22

Internal problem ID [14753]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 4, Section 4.3. The method of undetermined coefficients. Exercises page 151
Problem number : 22
Date solved : Thursday, October 02, 2025 at 09:50:47 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} 4 y+y^{\prime \prime }&=12 x^{2}-16 x \cos \left (2 x \right ) \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 37
ode:=diff(diff(y(x),x),x)+4*y(x) = 12*x^2-16*x*cos(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {3}{2}+\frac {\left (-8 x^{2}+4 c_2 +1\right ) \sin \left (2 x \right )}{4}+\left (-x +c_1 \right ) \cos \left (2 x \right )+3 x^{2} \]
Mathematica. Time used: 0.144 (sec). Leaf size: 44
ode=D[y[x],{x,2}]+4*y[x]==12*x^2-16*x*Cos[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to 3 x^2+\frac {1}{4} \left (-8 x^2+1+4 c_2\right ) \sin (2 x)+(-x+c_1) \cos (2 x)-\frac {3}{2} \end{align*}
Sympy. Time used: 0.091 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-12*x**2 + 16*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 )} = 3 x^{2} + \left (C_{1} - x\right ) \cos {\left (2 x \right )} + \left (C_{2} - 2 x^{2}\right ) \sin {\left (2 x \right )} - \frac {3}{2} \]