14.11.4 problem 4

Internal problem ID [2597]
Book : Differential equations and their applications, 4th ed., M. Braun
Section : Chapter 2. Second order differential equations. Section 2.5. Method of judicious guessing. Excercises page 164
Problem number : 4
Date solved : Tuesday, March 04, 2025 at 02:28:58 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

Maple. Time used: 0.003 (sec). Leaf size: 37
ode:=diff(diff(y(t),t),t)+diff(y(t),t)+y(t) = t^2+t+1; 
dsolve(ode,y(t), singsol=all);
 
\[ y = {\mathrm e}^{-\frac {t}{2}} \sin \left (\frac {\sqrt {3}\, t}{2}\right ) c_2 +{\mathrm e}^{-\frac {t}{2}} \cos \left (\frac {\sqrt {3}\, t}{2}\right ) c_1 +t^{2}-t \]
Mathematica. Time used: 0.025 (sec). Leaf size: 54
ode=D[y[t],{t,2}]+D[y[t],t]+y[t]==1+t+t^2; 
ic={}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to e^{-t/2} \left (e^{t/2} (t-1) t+c_2 \cos \left (\frac {\sqrt {3} t}{2}\right )+c_1 \sin \left (\frac {\sqrt {3} t}{2}\right )\right ) \]
Sympy. Time used: 0.167 (sec). Leaf size: 36
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(-t**2 - t + y(t) + Derivative(y(t), t) + Derivative(y(t), (t, 2)) - 1,0) 
ics = {} 
dsolve(ode,func=y(t),ics=ics)
 
\[ y{\left (t \right )} = t^{2} - t + \left (C_{1} \sin {\left (\frac {\sqrt {3} t}{2} \right )} + C_{2} \cos {\left (\frac {\sqrt {3} t}{2} \right )}\right ) e^{- \frac {t}{2}} \]