57.9.18 problem 2(g)

Internal problem ID [14426]
Book : A First Course in Differential Equations by J. David Logan. Third Edition. Springer-Verlag, NY. 2015.
Section : Chapter 2, Second order linear equations. Section 2.3.1 Nonhomogeneous Equations: Undetermined Coefficients. Exercises page 110
Problem number : 2(g)
Date solved : Thursday, October 02, 2025 at 09:37:03 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} x^{\prime \prime }-4 x&=\cos \left (2 t \right ) \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 23
ode:=diff(diff(x(t),t),t)-4*x(t) = cos(2*t); 
dsolve(ode,x(t), singsol=all);
 
\[ x = {\mathrm e}^{-2 t} c_2 +{\mathrm e}^{2 t} c_1 -\frac {\cos \left (2 t \right )}{8} \]
Mathematica. Time used: 0.07 (sec). Leaf size: 30
ode=D[x[t],{t,2}]-4*x[t]==Cos[2*t]; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to -\frac {1}{8} \cos (2 t)+c_1 e^{2 t}+c_2 e^{-2 t} \end{align*}
Sympy. Time used: 0.048 (sec). Leaf size: 22
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(-4*x(t) - cos(2*t) + Derivative(x(t), (t, 2)),0) 
ics = {} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = C_{1} e^{- 2 t} + C_{2} e^{2 t} - \frac {\cos {\left (2 t \right )}}{8} \]