71.13.5 problem 5

Internal problem ID [14454]
Book : Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section : Chapter 5. The Laplace Transform Method. Exercises 5.2, page 248
Problem number : 5
Date solved : Monday, March 31, 2025 at 12:27:32 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Using Laplace method

Maple. Time used: 0.110 (sec). Leaf size: 29
ode:=diff(diff(y(x),x),x)+9*y(x) = 2*sin(3*x); 
dsolve(ode,y(x),method='laplace');
 
\[ y = -\frac {\cos \left (3 x \right ) \left (x -3 y \left (0\right )\right )}{3}+\frac {\sin \left (3 x \right ) \left (1+3 y^{\prime }\left (0\right )\right )}{9} \]
Mathematica. Time used: 0.036 (sec). Leaf size: 64
ode=D[y[x],{x,2}]+9*y[x]==2*Sin[3*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \sin (3 x) \int _1^x\frac {1}{3} \sin (6 K[2])dK[2]+\cos (3 x) \int _1^x-\frac {2}{3} \sin ^2(3 K[1])dK[1]+c_1 \cos (3 x)+c_2 \sin (3 x) \]
Sympy. Time used: 0.104 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(9*y(x) - 2*sin(3*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} \sin {\left (3 x \right )} + \left (C_{1} - \frac {x}{3}\right ) \cos {\left (3 x \right )} \]