80.5.46 problem C 22

Internal problem ID [21267]
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 22
Date solved : Thursday, October 02, 2025 at 07:27:30 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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