2.11.21 problem 44

Internal problem ID [889]
Book : Differential equations and linear algebra, 3rd ed., Edwards and Penney
Section : Section 5.5, Nonhomogeneous equations and undetermined coefficients Page 351
Problem number : 44
Date solved : Tuesday, September 30, 2025 at 04:19:05 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y^{\prime }+y&=\sin \left (x \right ) \sin \left (3 x \right ) \end{align*}
Maple. Time used: 0.015 (sec). Leaf size: 55
ode:=diff(diff(y(x),x),x)+diff(y(x),x)+y(x) = sin(x)*sin(3*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-\frac {x}{2}} \sin \left (\frac {\sqrt {3}\, x}{2}\right ) c_2 +{\mathrm e}^{-\frac {x}{2}} \cos \left (\frac {\sqrt {3}\, x}{2}\right ) c_1 -\frac {3 \cos \left (2 x \right )}{26}+\frac {15 \cos \left (4 x \right )}{482}-\frac {2 \sin \left (4 x \right )}{241}+\frac {\sin \left (2 x \right )}{13} \]
Mathematica. Time used: 1.365 (sec). Leaf size: 80
ode=D[y[x],{x,2}]+D[y[x],x]+y[x]==Sin[x]*Sin[3*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {1}{13} \sin (2 x)-\frac {2}{241} \sin (4 x)-\frac {3}{26} \cos (2 x)+\frac {15}{482} \cos (4 x)+c_2 e^{-x/2} \cos \left (\frac {\sqrt {3} x}{2}\right )+c_1 e^{-x/2} \sin \left (\frac {\sqrt {3} x}{2}\right ) \end{align*}
Sympy. Time used: 22.892 (sec). Leaf size: 70
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) - sin(x)*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 )} = \frac {15 \left (1 - \cos {\left (2 x \right )}\right )^{2}}{241} + \left (C_{1} \sin {\left (\frac {\sqrt {3} x}{2} \right )} + C_{2} \cos {\left (\frac {\sqrt {3} x}{2} \right )}\right ) e^{- \frac {x}{2}} + \frac {\sin {\left (2 x \right )}}{13} - \frac {2 \sin {\left (4 x \right )}}{241} + \frac {57 \cos {\left (2 x \right )}}{6266} - \frac {45}{482} \]