15.11.15 problem 15

Internal problem ID [3125]
Book : Differential Equations by Alfred L. Nelson, Karl W. Folley, Max Coral. 3rd ed. DC heath. Boston. 1964
Section : Exercise 19, page 86
Problem number : 15
Date solved : Tuesday, March 04, 2025 at 04:00:43 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y^{\prime }+y&={\mathrm e}^{x} \sin \left (3 x \right ) \end{align*}

Maple. Time used: 0.210 (sec). Leaf size: 46
ode:=diff(diff(y(x),x),x)+diff(y(x),x)+y(x) = exp(x)*sin(3*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-\frac {x}{2}} \cos \left (\frac {\sqrt {3}\, x}{2}\right ) c_{1} +{\mathrm e}^{-\frac {x}{2}} \sin \left (\frac {\sqrt {3}\, x}{2}\right ) c_2 -\frac {\left (\cos \left (3 x \right )+\frac {2 \sin \left (3 x \right )}{3}\right ) {\mathrm e}^{x}}{13} \]
Mathematica. Time used: 1.921 (sec). Leaf size: 70
ode=D[y[x],{x,2}]+D[y[x],x]+y[x]==Exp[x]*Sin[3*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {2}{39} e^x \sin (3 x)-\frac {1}{13} e^x \cos (3 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 ) \]
Sympy. Time used: 0.247 (sec). Leaf size: 51
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) - exp(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 )} = \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 {\left (- 2 \sin {\left (3 x \right )} - 3 \cos {\left (3 x \right )}\right ) e^{x}}{39} \]