64.11.33 problem 33

Internal problem ID [13404]
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 : 33
Date solved : Wednesday, March 05, 2025 at 09:52:19 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-4 y^{\prime }+13 y&=8 \sin \left (3 x \right ) \end{align*}

With initial conditions

\begin{align*} y \left (0\right )&=1\\ y^{\prime }\left (0\right )&=2 \end{align*}

Maple. Time used: 0.026 (sec). Leaf size: 31
ode:=diff(diff(y(x),x),x)-4*diff(y(x),x)+13*y(x) = 8*sin(3*x); 
ic:=y(0) = 1, D(y)(0) = 2; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \frac {\left (2 \,{\mathrm e}^{2 x}+3\right ) \cos \left (3 x \right )}{5}+\frac {\sin \left (3 x \right ) \left (1+{\mathrm e}^{2 x}\right )}{5} \]
Mathematica. Time used: 0.023 (sec). Leaf size: 36
ode=D[y[x],{x,2}]-4*D[y[x],x]+13*y[x]==8*Sin[3*x]; 
ic={y[0]==1,Derivative[1][y][0] ==2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{5} \left (\left (e^{2 x}+1\right ) \sin (3 x)+\left (2 e^{2 x}+3\right ) \cos (3 x)\right ) \]
Sympy. Time used: 0.254 (sec). Leaf size: 37
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(13*y(x) - 8*sin(3*x) - 4*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {y(0): 1, Subs(Derivative(y(x), x), x, 0): 2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (\frac {\sin {\left (3 x \right )}}{5} + \frac {2 \cos {\left (3 x \right )}}{5}\right ) e^{2 x} + \frac {\sin {\left (3 x \right )}}{5} + \frac {3 \cos {\left (3 x \right )}}{5} \]