70.15.13 problem 13

Internal problem ID [18941]
Book : Differential equations. An introduction to modern methods and applications. James Brannan, William E. Boyce. Third edition. Wiley 2015
Section : Chapter 4. Second order linear equations. Section 4.5 (Nonhomogeneous Equations, Method of Undetermined Coefficients). Problems at page 260
Problem number : 13
Date solved : Thursday, October 02, 2025 at 03:33:11 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} u^{\prime \prime }+w_{0}^{2} u&=\cos \left (w t \right ) \end{align*}
Maple. Time used: 0.005 (sec). Leaf size: 34
ode:=diff(diff(u(t),t),t)+w__0^2*u(t) = cos(w*t); 
dsolve(ode,u(t), singsol=all);
 
\[ u = \sin \left (w_{0} t \right ) c_2 +\cos \left (w_{0} t \right ) c_1 -\frac {\cos \left (w t \right )}{w^{2}-w_{0}^{2}} \]
Mathematica. Time used: 0.063 (sec). Leaf size: 73
ode=D[u[t],{t,2}]+w0^2*u[t]==Cos[w*t]; 
ic={}; 
DSolve[{ode,ic},u[t],t,IncludeSingularSolutions->True]
 
\begin{align*} u(t)&\to \cos (t \text {w0}) \int _1^t-\frac {\cos (w K[1]) \sin (\text {w0} K[1])}{\text {w0}}dK[1]+\sin (t \text {w0}) \int _1^t\frac {\cos (w K[2]) \cos (\text {w0} K[2])}{\text {w0}}dK[2]+c_1 \cos (t \text {w0})+c_2 \sin (t \text {w0}) \end{align*}
Sympy. Time used: 0.066 (sec). Leaf size: 31
from sympy import * 
t = symbols("t") 
w = symbols("w") 
w__0 = symbols("w__0") 
u = Function("u") 
ode = Eq(w__0**2*u(t) - cos(t*w) + Derivative(u(t), (t, 2)),0) 
ics = {} 
dsolve(ode,func=u(t),ics=ics)
 
\[ u{\left (t \right )} = C_{1} e^{- i t w^{0}} + C_{2} e^{i t w^{0}} - \frac {\cos {\left (t w \right )}}{w^{2} - \left (w^{0}\right )^{2}} \]