63.9.15 problem 2(c)

Internal problem ID [13063]
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(c)
Date solved : Wednesday, March 05, 2025 at 09:11:46 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} x^{\prime \prime }+x&=t^{2} \end{align*}

Maple. Time used: 0.003 (sec). Leaf size: 17
ode:=diff(diff(x(t),t),t)+x(t) = t^2; 
dsolve(ode,x(t), singsol=all);
 
\[ x \left (t \right ) = c_{2} \sin \left (t \right )+\cos \left (t \right ) c_{1} +t^{2}-2 \]
Mathematica. Time used: 0.012 (sec). Leaf size: 20
ode=D[x[t],{t,2}]+x[t]==t^2; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\[ x(t)\to t^2+c_1 \cos (t)+c_2 \sin (t)-2 \]
Sympy. Time used: 0.067 (sec). Leaf size: 17
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(-t**2 + 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 )} + t^{2} - 2 \]