59.4.8 problem 9.1 (viii)

Internal problem ID [15019]
Book : AN INTRODUCTION TO ORDINARY DIFFERENTIAL EQUATIONS by JAMES C. ROBINSON. Cambridge University Press 2004
Section : Chapter 9, First order linear equations and the integrating factor. Exercises page 86
Problem number : 9.1 (viii)
Date solved : Thursday, October 02, 2025 at 10:01:13 AM
CAS classification : [_linear]

\begin{align*} x^{\prime }+\left (a +\frac {1}{t}\right ) x&=b \end{align*}

With initial conditions

\begin{align*} x \left (1\right )&=x_{0} \\ \end{align*}
Maple. Time used: 0.030 (sec). Leaf size: 38
ode:=diff(x(t),t)+(a+1/t)*x(t) = b; 
ic:=[x(1) = x__0]; 
dsolve([ode,op(ic)],x(t), singsol=all);
 
\[ x = \frac {\left (x_{0} a^{2}-b a +b \right ) {\mathrm e}^{-a \left (t -1\right )}+b \left (a t -1\right )}{a^{2} t} \]
Mathematica. Time used: 0.04 (sec). Leaf size: 48
ode=D[x[t],t]+(a+1/t)*x[t]==b; 
ic={x[1]==x0}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to \frac {e^{-a t} \left (e^a a^2 \text {x0}+b e^{a t} (a t-1)-(a-1) e^a b\right )}{a^2 t} \end{align*}
Sympy
from sympy import * 
t = symbols("t") 
a = symbols("a") 
b = symbols("b") 
x = Function("x") 
ode = Eq(-b + (a + 1/t)*x(t) + Derivative(x(t), t),0) 
ics = {x(1): x__0} 
dsolve(ode,func=x(t),ics=ics)