65.7.6 problem 14.1 (vi)

Internal problem ID [13691]
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 (vi)
Date solved : Wednesday, March 05, 2025 at 10:12:12 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.009 (sec). Leaf size: 33
ode:=diff(diff(x(t),t),t)+omega^2*x(t) = sin(alpha*t); 
dsolve(ode,x(t), singsol=all);
 
\[ x \left (t \right ) = \sin \left (\omega t \right ) c_{2} +\cos \left (\omega t \right ) c_{1} +\frac {\sin \left (\alpha t \right )}{-\alpha ^{2}+\omega ^{2}} \]
Mathematica. Time used: 0.109 (sec). Leaf size: 73
ode=D[x[t],{t,2}]+w^2*x[t]==Sin[a*t]; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\[ x(t)\to \cos (t w) \int _1^t-\frac {\sin (a K[1]) \sin (w K[1])}{w}dK[1]+\sin (t w) \int _1^t\frac {\cos (w K[2]) \sin (a K[2])}{w}dK[2]+c_1 \cos (t w)+c_2 \sin (t w) \]
Sympy. Time used: 0.112 (sec). Leaf size: 31
from sympy import * 
t = symbols("t") 
Alpha = symbols("Alpha") 
omega = symbols("omega") 
x = Function("x") 
ode = Eq(omega**2*x(t) - sin(Alpha*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 {\sin {\left (\mathrm {A} t \right )}}{\mathrm {A}^{2} - \omega ^{2}} \]