80.5.44 problem C 20

Internal problem ID [21265]
Book : A Textbook on Ordinary Differential Equations by Shair Ahmad and Antonio Ambrosetti. Second edition. ISBN 978-3-319-16407-6. Springer 2015
Section : Chapter 5. Second order equations. Excercise 5.9 at page 119
Problem number : C 20
Date solved : Thursday, October 02, 2025 at 07:27:28 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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