59.7.7 problem 14.1 (vii)

Internal problem ID [15052]
Book : AN INTRODUCTION TO ORDINARY DIFFERENTIAL EQUATIONS by JAMES C. ROBINSON. Cambridge University Press 2004
Section : Chapter 14, Inhomogeneous second order linear equations. Exercises page 140
Problem number : 14.1 (vii)
Date solved : Thursday, October 02, 2025 at 10:02:25 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} x^{\prime \prime }+\omega ^{2} x&=\sin \left (\omega t \right ) \end{align*}
Maple. Time used: 0.005 (sec). Leaf size: 36
ode:=diff(diff(x(t),t),t)+omega^2*x(t) = sin(omega*t); 
dsolve(ode,x(t), singsol=all);
 
\[ x = \frac {\sin \left (\omega t \right ) \left (2 c_2 \,\omega ^{2}+1\right )-\omega \cos \left (\omega t \right ) \left (-2 c_1 \omega +t \right )}{2 \omega ^{2}} \]
Mathematica. Time used: 0.027 (sec). Leaf size: 29
ode=D[x[t],{t,2}]+w^2*x[t]==Sin[w*t]; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to \left (-\frac {t}{2 w}+c_1\right ) \cos (t w)+c_2 \sin (t w) \end{align*}
Sympy. Time used: 0.073 (sec). Leaf size: 29
from sympy import * 
t = symbols("t") 
omega = symbols("omega") 
x = Function("x") 
ode = Eq(omega**2*x(t) - sin(omega*t) + Derivative(x(t), (t, 2)),0) 
ics = {} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = C_{1} e^{- i \omega t} + C_{2} e^{i \omega t} - \frac {t \cos {\left (\omega t \right )}}{2 \omega } \]