90.4.17 problem 18

Internal problem ID [25112]
Book : Ordinary Differential Equations. By William Adkins and Mark G Davidson. Springer. NY. 2010. ISBN 978-1-4614-3617-1
Section : Chapter 1. First order differential equations. Exercises at page 59
Problem number : 18
Date solved : Thursday, October 02, 2025 at 11:50:29 PM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }+a y&=t^{n} {\mathrm e}^{-a t} \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 23
ode:=diff(y(t),t)+a*y(t) = t^n*exp(-a*t); 
dsolve(ode,y(t), singsol=all);
 
\[ y = \left (\frac {t^{n +1}}{n +1}+c_1 \right ) {\mathrm e}^{-a t} \]
Mathematica. Time used: 0.034 (sec). Leaf size: 29
ode=D[y[t],{t,1}] +a*y[t]== t^n*Exp[-a*t]; 
ic={}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\begin{align*} y(t)&\to \frac {e^{-a t} \left (t^{n+1}+c_1 (n+1)\right )}{n+1} \end{align*}
Sympy. Time used: 0.567 (sec). Leaf size: 71
from sympy import * 
t = symbols("t") 
a = symbols("a") 
n = symbols("n") 
y = Function("y") 
ode = Eq(a*y(t) - t**n*exp(-a*t) + Derivative(y(t), t),0) 
ics = {} 
dsolve(ode,func=y(t),ics=ics)
 
\[ \left [ y{\left (t \right )} = \begin {cases} C_{1} e^{- a t} + e^{- a t} \log {\left (t \right )} & \text {for}\: n = -1 \\\text {NaN} & \text {otherwise} \end {cases}, \ y{\left (t \right )} = \begin {cases} \frac {C_{1} n}{n e^{a t} + e^{a t}} + \frac {C_{1}}{n e^{a t} + e^{a t}} + \frac {t^{n + 1}}{n e^{a t} + e^{a t}} & \text {for}\: n \neq -1 \\\text {NaN} & \text {otherwise} \end {cases}\right ] \]