50.15.2 problem 4

Internal problem ID [8068]
Book : Differential Equations: Theory, Technique, and Practice by George Simmons, Steven Krantz. McGraw-Hill NY. 2007. 1st Edition.
Section : Chapter 2. Problems for Review and Discovery. Challenge excercises. Page 105
Problem number : 4
Date solved : Sunday, March 30, 2025 at 12:42:01 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.002 (sec). Leaf size: 23
ode:=diff(diff(y(x),x),x)+9*y(x) = -3*cos(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (3 x \right ) c_2 +\cos \left (3 x \right ) c_1 -\frac {3 \cos \left (2 x \right )}{5} \]
Mathematica. Time used: 0.017 (sec). Leaf size: 28
ode=D[y[x],{x,2}]+9*y[x]==-3*Cos[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {3}{5} \cos (2 x)+c_1 \cos (3 x)+c_2 \sin (3 x) \]
Sympy. Time used: 0.076 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(9*y(x) + 3*cos(2*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (3 x \right )} + C_{2} \cos {\left (3 x \right )} - \frac {3 \cos {\left (2 x \right )}}{5} \]