8.11.3 problem 3

Internal problem ID [871]
Book : Differential equations and linear algebra, 3rd ed., Edwards and Penney
Section : Section 5.5, Nonhomogeneous equations and undetermined coefficients Page 351
Problem number : 3
Date solved : Tuesday, March 04, 2025 at 11:55:13 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-y^{\prime }-6 y&=2 \sin \left (3 x \right ) \end{align*}

Maple. Time used: 0.005 (sec). Leaf size: 34
ode:=diff(diff(y(x),x),x)-diff(y(x),x)-6*y(x) = 2*sin(3*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-2 x} \left (\frac {\left (\cos \left (3 x \right )-5 \sin \left (3 x \right )\right ) {\mathrm e}^{2 x}}{39}+{\mathrm e}^{5 x} c_2 +c_1 \right ) \]
Mathematica. Time used: 0.018 (sec). Leaf size: 37
ode=D[y[x],{x,2}]-D[y[x],x]-6*y[x]==2*Sin[3*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to c_1 e^{-2 x}+c_2 e^{3 x}+\frac {1}{39} (\cos (3 x)-5 \sin (3 x)) \]
Sympy. Time used: 0.204 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-6*y(x) - 2*sin(3*x) - Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- 2 x} + C_{2} e^{3 x} - \frac {5 \sin {\left (3 x \right )}}{39} + \frac {\cos {\left (3 x \right )}}{39} \]