70.5.26 problem 27

Internal problem ID [18733]
Book : Differential equations. An introduction to modern methods and applications. James Brannan, William E. Boyce. Third edition. Wiley 2015
Section : Chapter 2. First order differential equations. Section 2.7 (Substitution Methods). Problems at page 108
Problem number : 27
Date solved : Thursday, October 02, 2025 at 03:29:22 PM
CAS classification : [_linear]

\begin{align*} x y^{\prime }+\left (1+x \right ) y&=x \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 17
ode:=x*diff(y(x),x)+(1+x)*y(x) = x; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {{\mathrm e}^{-x} c_1 +x -1}{x} \]
Mathematica. Time used: 0.036 (sec). Leaf size: 35
ode=x*D[y[x],x]+(x+1)*y[x]==x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {e^{-x-1} \left (\int _1^xe^{K[1]+1} K[1]dK[1]+c_1\right )}{x} \end{align*}
Sympy. Time used: 0.157 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), x) - x + (x + 1)*y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1} e^{- x}}{x} + 1 - \frac {1}{x} \]