58.11.42 problem 42

Internal problem ID [14773]
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 : 42
Date solved : Thursday, October 02, 2025 at 09:51:02 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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