80.5.36 problem C 12

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

\begin{align*} x^{\prime \prime }+x&=\sin \left (2 t \right )-\cos \left (3 t \right ) \end{align*}
Maple. Time used: 0.004 (sec). Leaf size: 27
ode:=diff(diff(x(t),t),t)+x(t) = sin(2*t)-cos(3*t); 
dsolve(ode,x(t), singsol=all);
 
\[ x = \frac {\left (-3 \sin \left (t \right )^{2}+6 c_1 -4 \sin \left (t \right )\right ) \cos \left (t \right )}{6}+\sin \left (t \right ) c_2 \]
Mathematica. Time used: 0.072 (sec). Leaf size: 36
ode=D[x[t],{t,2}]+x[t]==Sin[2*t]-Cos[3*t]; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to -\frac {1}{3} \sin (2 t)+\frac {1}{8} \cos (3 t)+\left (\frac {1}{4}+c_1\right ) \cos (t)+c_2 \sin (t) \end{align*}
Sympy. Time used: 0.044 (sec). Leaf size: 26
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(x(t) - sin(2*t) + cos(3*t) + Derivative(x(t), (t, 2)),0) 
ics = {} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = C_{1} \sin {\left (t \right )} + C_{2} \cos {\left (t \right )} - \frac {\sin {\left (2 t \right )}}{3} + \frac {\cos {\left (3 t \right )}}{8} \]