72.6.13 problem 21

Internal problem ID [14667]
Book : DIFFERENTIAL EQUATIONS by Paul Blanchard, Robert L. Devaney, Glen R. Hall. 4th edition. Brooks/Cole. Boston, USA. 2012
Section : Chapter 1. First-Order Differential Equations. Exercises section 1.8 page 121
Problem number : 21
Date solved : Monday, March 31, 2025 at 12:52:06 PM
CAS classification : [[_linear, `class A`]]

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

Maple. Time used: 0.001 (sec). Leaf size: 26
ode:=diff(y(t),t)+2*y(t) = t^2+2*t+1+exp(4*t); 
dsolve(ode,y(t), singsol=all);
 
\[ y = \frac {1}{4}+\frac {{\mathrm e}^{4 t}}{6}+\frac {t^{2}}{2}+\frac {t}{2}+{\mathrm e}^{-2 t} c_1 \]
Mathematica. Time used: 0.561 (sec). Leaf size: 41
ode=D[y[t],t]+2*y[t]==t^2+2*t+1+Exp[4*t]; 
ic={}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to e^{-2 t} \left (\int _1^te^{2 K[1]} \left ((K[1]+1)^2+e^{4 K[1]}\right )dK[1]+c_1\right ) \]
Sympy. Time used: 0.164 (sec). Leaf size: 27
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(-t**2 - 2*t + 2*y(t) - exp(4*t) + Derivative(y(t), t) - 1,0) 
ics = {} 
dsolve(ode,func=y(t),ics=ics)
 
\[ y{\left (t \right )} = C_{1} e^{- 2 t} + \frac {t^{2}}{2} + \frac {t}{2} + \frac {e^{4 t}}{6} + \frac {1}{4} \]