72.18.1 problem 1

Internal problem ID [14883]
Book : DIFFERENTIAL EQUATIONS by Paul Blanchard, Robert L. Devaney, Glen R. Hall. 4th edition. Brooks/Cole. Boston, USA. 2012
Section : Chapter 4. Forcing and Resonance. Section 4.3 page 424
Problem number : 1
Date solved : Monday, March 31, 2025 at 01:01:19 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+9 y&=\cos \left (t \right ) \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 21
ode:=diff(diff(y(t),t),t)+9*y(t) = cos(t); 
dsolve(ode,y(t), singsol=all);
 
\[ y = \sin \left (3 t \right ) c_2 +\cos \left (3 t \right ) c_1 +\frac {\cos \left (t \right )}{8} \]
Mathematica. Time used: 0.074 (sec). Leaf size: 68
ode=D[y[t],{t,2}]+9*y[t]==Cos[t]; 
ic={}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to \cos (3 t) \int _1^t-\frac {1}{3} \cos (K[1]) \sin (3 K[1])dK[1]+\sin (3 t) \int _1^t\frac {1}{3} \cos (K[2]) \cos (3 K[2])dK[2]+c_1 \cos (3 t)+c_2 \sin (3 t) \]
Sympy. Time used: 0.077 (sec). Leaf size: 20
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(9*y(t) - cos(t) + Derivative(y(t), (t, 2)),0) 
ics = {} 
dsolve(ode,func=y(t),ics=ics)
 
\[ y{\left (t \right )} = C_{1} \sin {\left (3 t \right )} + C_{2} \cos {\left (3 t \right )} + \frac {\cos {\left (t \right )}}{8} \]