63.9.18 problem 2(g)

Internal problem ID [13066]
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 : Wednesday, March 05, 2025 at 09:11:53 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.004 (sec). Leaf size: 23
ode:=diff(diff(x(t),t),t)-4*x(t) = cos(2*t); 
dsolve(ode,x(t), singsol=all);
 
\[ x \left (t \right ) = c_{2} {\mathrm e}^{2 t}+c_{1} {\mathrm e}^{-2 t}-\frac {\cos \left (2 t \right )}{8} \]
Mathematica. Time used: 0.081 (sec). Leaf size: 72
ode=D[x[t],{t,2}]-4*x[t]==Cos[2*t]; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\[ x(t)\to e^{-2 t} \left (e^{4 t} \int _1^t\frac {1}{4} e^{-2 K[1]} \cos (2 K[1])dK[1]+\int _1^t-\frac {1}{4} e^{2 K[2]} \cos (2 K[2])dK[2]+c_1 e^{4 t}+c_2\right ) \]
Sympy. Time used: 0.087 (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} \]