76.33.4 problem Ex. 4

Internal problem ID [20182]
Book : Introductory Course On Differential Equations by Daniel A Murray. Longmans Green and Co. NY. 1924
Section : Chapter VI. Linear equations with constant coefficients. Examples on chapter VI, page 80
Problem number : Ex. 4
Date solved : Thursday, October 02, 2025 at 05:34:00 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} 4 y+y^{\prime \prime }&=\sin \left (3 x \right )+{\mathrm e}^{x}+x^{2} \end{align*}
Maple. Time used: 0.006 (sec). Leaf size: 39
ode:=diff(diff(y(x),x),x)+4*y(x) = sin(3*x)+exp(x)+x^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {\sin \left (3 x \right )}{5}-\frac {1}{8}+\frac {\cos \left (2 x \right )}{8}+\frac {x^{2}}{4}+\cos \left (2 x \right ) c_1 +\sin \left (2 x \right ) c_2 +\frac {{\mathrm e}^{x}}{5} \]
Mathematica. Time used: 0.259 (sec). Leaf size: 45
ode=D[y[x],{x,2}]+4*y[x]==Sin[3*x]+Exp[x]+x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {x^2}{4}+\frac {e^x}{5}-\frac {1}{5} \sin (3 x)+c_1 \cos (2 x)+c_2 \sin (2 x)-\frac {1}{8} \end{align*}
Sympy. Time used: 0.060 (sec). Leaf size: 36
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + 4*y(x) - exp(x) - sin(3*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (2 x \right )} + C_{2} \cos {\left (2 x \right )} + \frac {x^{2}}{4} + \frac {e^{x}}{5} - \frac {\sin {\left (3 x \right )}}{5} - \frac {1}{8} \]