34.11.10 problem 36

Internal problem ID [8031]
Book : Schaums Outline. Theory and problems of Differential Equations, 1st edition. Frank Ayres. McGraw Hill 1952
Section : Chapter 16. Linear equations with constant coefficients (Short methods). Supplemetary problems. Page 107
Problem number : 36
Date solved : Tuesday, September 30, 2025 at 05:14:27 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+2 y&=x^{3}+x^{2}+{\mathrm e}^{-2 x}+\cos \left (3 x \right ) \end{align*}
Maple. Time used: 0.008 (sec). Leaf size: 47
ode:=diff(diff(y(x),x),x)+2*y(x) = x^3+x^2+exp(-2*x)+cos(3*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (\sqrt {2}\, x \right ) c_2 +\cos \left (\sqrt {2}\, x \right ) c_1 +\frac {x^{3}}{2}+\frac {x^{2}}{2}-\frac {\cos \left (3 x \right )}{7}-\frac {3 x}{2}-\frac {1}{2}+\frac {{\mathrm e}^{-2 x}}{6} \]
Mathematica. Time used: 1.085 (sec). Leaf size: 161
ode=D[y[x],{x,2}]+2*y[x]==x^3+x^2+Exp[-2*x]+Cos[3*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \cos \left (\sqrt {2} x\right ) \int _1^x-\frac {e^{-2 K[1]} \left (e^{2 K[1]} (K[1]+1) K[1]^2+e^{2 K[1]} \cos (3 K[1])+1\right ) \sin \left (\sqrt {2} K[1]\right )}{\sqrt {2}}dK[1]+\sin \left (\sqrt {2} x\right ) \int _1^x\frac {e^{-2 K[2]} \cos \left (\sqrt {2} K[2]\right ) \left (e^{2 K[2]} (K[2]+1) K[2]^2+e^{2 K[2]} \cos (3 K[2])+1\right )}{\sqrt {2}}dK[2]+c_1 \cos \left (\sqrt {2} x\right )+c_2 \sin \left (\sqrt {2} x\right ) \end{align*}
Sympy. Time used: 0.086 (sec). Leaf size: 56
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**3 - x**2 + 2*y(x) - cos(3*x) + Derivative(y(x), (x, 2)) - exp(-2*x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (\sqrt {2} x \right )} + C_{2} \cos {\left (\sqrt {2} x \right )} + \frac {x^{3}}{2} + \frac {x^{2}}{2} - \frac {3 x}{2} - \frac {\cos {\left (3 x \right )}}{7} - \frac {1}{2} + \frac {e^{- 2 x}}{6} \]