65.8.1 problem 15.1

Internal problem ID [13699]
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.1
Date solved : Wednesday, March 05, 2025 at 10:13:11 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} x^{\prime \prime }+\omega ^{2} x&=\cos \left (\alpha 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.029 (sec). Leaf size: 27
ode:=diff(diff(x(t),t),t)+omega^2*x(t) = cos(alpha*t); 
ic:=x(0) = 0, D(x)(0) = 0; 
dsolve([ode,ic],x(t), singsol=all);
 
\[ x \left (t \right ) = \frac {\cos \left (\omega t \right )-\cos \left (\alpha t \right )}{\alpha ^{2}-\omega ^{2}} \]
Mathematica. Time used: 0.081 (sec). Leaf size: 111
ode=D[x[t],{t,2}]+w^2*x[t]==Cos[a*t]; 
ic={x[0]==0,Derivative[1][x][0 ]==0}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\[ x(t)\to -\sin (t w) \int _1^0\frac {\cos (a K[2]) \cos (w K[2])}{w}dK[2]+\sin (t w) \int _1^t\frac {\cos (a K[2]) \cos (w K[2])}{w}dK[2]+\cos (t w) \left (\int _1^t-\frac {\cos (a K[1]) \sin (w K[1])}{w}dK[1]-\int _1^0-\frac {\cos (a K[1]) \sin (w K[1])}{w}dK[1]\right ) \]
Sympy. Time used: 0.142 (sec). Leaf size: 49
from sympy import * 
t = symbols("t") 
Alpha = symbols("Alpha") 
omega = symbols("omega") 
x = Function("x") 
ode = Eq(omega**2*x(t) - cos(Alpha*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 {e^{i \omega t}}{2 \mathrm {A}^{2} - 2 \omega ^{2}} + \frac {e^{- i \omega t}}{2 \mathrm {A}^{2} - 2 \omega ^{2}} - \frac {\cos {\left (\mathrm {A} t \right )}}{\mathrm {A}^{2} - \omega ^{2}} \]