80.5.28 problem C 4

Internal problem ID [21249]
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 4
Date solved : Thursday, October 02, 2025 at 07:27:19 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} x^{\prime \prime }+x&=3 t^{2}+t \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 20
ode:=diff(diff(x(t),t),t)+x(t) = 3*t^2+t; 
dsolve(ode,x(t), singsol=all);
 
\[ x = \sin \left (t \right ) c_2 +\cos \left (t \right ) c_1 +3 t^{2}+t -6 \]
Mathematica. Time used: 0.009 (sec). Leaf size: 23
ode=D[x[t],{t,2}]+x[t]==3*t^2+t; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to 3 t^2+t+c_1 \cos (t)+c_2 \sin (t)-6 \end{align*}
Sympy. Time used: 0.035 (sec). Leaf size: 20
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(-3*t**2 - t + x(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 )} + 3 t^{2} + t - 6 \]