59.8.2 problem 15.3

Internal problem ID [15060]
Book : AN INTRODUCTION TO ORDINARY DIFFERENTIAL EQUATIONS by JAMES C. ROBINSON. Cambridge University Press 2004
Section : Chapter 15, Resonance. Exercises page 148
Problem number : 15.3
Date solved : Thursday, October 02, 2025 at 10:02:31 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} x^{\prime \prime }+\omega ^{2} x&=\cos \left (\omega t \right ) \end{align*}

With initial conditions

\begin{align*} x \left (0\right )&=0 \\ x^{\prime }\left (0\right )&=0 \\ \end{align*}
Maple. Time used: 0.016 (sec). Leaf size: 14
ode:=diff(diff(x(t),t),t)+omega^2*x(t) = cos(omega*t); 
ic:=[x(0) = 0, D(x)(0) = 0]; 
dsolve([ode,op(ic)],x(t), singsol=all);
 
\[ x = \frac {\sin \left (\omega t \right ) t}{2 \omega } \]
Mathematica. Time used: 0.033 (sec). Leaf size: 17
ode=D[x[t],{t,2}]+w^2*x[t]==Cos[w*t]; 
ic={x[0]==0,Derivative[1][x][0 ]==0}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to \frac {t \sin (t w)}{2 w} \end{align*}
Sympy. Time used: 0.087 (sec). Leaf size: 12
from sympy import * 
t = symbols("t") 
omega = symbols("omega") 
x = Function("x") 
ode = Eq(omega**2*x(t) - cos(omega*t) + Derivative(x(t), (t, 2)),0) 
ics = {x(0): 0, Subs(Derivative(x(t), t), t, 0): 0} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = \frac {t \sin {\left (\omega t \right )}}{2 \omega } \]