14.3.18 problem Problem 18

Internal problem ID [3627]
Book : Differential equations and linear algebra, Stephen W. Goode and Scott A Annin. Fourth edition, 2015
Section : Chapter 1, First-Order Differential Equations. Section 1.6, First-Order Linear Differential Equations. page 59
Problem number : Problem 18
Date solved : Tuesday, September 30, 2025 at 06:48:42 AM
CAS classification : [_linear]

\begin{align*} x^{\prime }+\frac {2 x}{4-t}&=5 \end{align*}

With initial conditions

\begin{align*} x \left (0\right )&=4 \\ \end{align*}
Maple. Time used: 0.019 (sec). Leaf size: 14
ode:=diff(x(t),t)+2/(4-t)*x(t) = 5; 
ic:=[x(0) = 4]; 
dsolve([ode,op(ic)],x(t), singsol=all);
 
\[ x = -t^{2}+3 t +4 \]
Mathematica. Time used: 0.018 (sec). Leaf size: 15
ode=D[x[t],t]+2/(4-t)*x[t]==5; 
ic={x[0]==4}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to -t^2+3 t+4 \end{align*}
Sympy. Time used: 0.229 (sec). Leaf size: 10
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(Derivative(x(t), t) - 5 + 2*x(t)/(4 - t),0) 
ics = {x(0): 4} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = - t^{2} + 3 t + 4 \]