64.11.42 problem 42

Internal problem ID [13413]
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 : Wednesday, March 05, 2025 at 09:52:45 PM
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.006 (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 = \sin \left (3 x \right ) c_{2} +\cos \left (3 x \right ) c_{1} +\frac {\left (2 \sin \left (3 x \right )-4 \cos \left (3 x \right )+5\right ) {\mathrm e}^{3 x}}{90}+\frac {{\mathrm e}^{-3 x}}{18} \]
Mathematica. Time used: 0.637 (sec). Leaf size: 114
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]
 
\[ y(x)\to \cos (3 x) \int _1^x-\frac {1}{3} e^{-3 K[1]} \sin (3 K[1]) \left (e^{6 K[1]} \sin (3 K[1])+e^{6 K[1]}+1\right )dK[1]+\sin (3 x) \int _1^x\frac {1}{3} e^{-3 K[2]} \cos (3 K[2]) \left (e^{6 K[2]} \sin (3 K[2])+e^{6 K[2]}+1\right )dK[2]+c_1 \cos (3 x)+c_2 \sin (3 x) \]
Sympy. Time used: 0.194 (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} \]