31.2.5 problem 10.3.6

Internal problem ID [7690]
Book : Basic Training in Mathematics. By R. Shankar. Plenum Press. NY. 1995
Section : Chapter 10, Differential equations. Section 10.3, ODEs with variable Coefficients. First order. page 315
Problem number : 10.3.6
Date solved : Tuesday, September 30, 2025 at 04:56:01 PM
CAS classification : [_linear]

\begin{align*} y^{\prime }+\frac {y}{1-x}+2 x -x^{2}&=0 \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 25
ode:=diff(y(x),x)+y(x)/(1-x)+2*x-x^2 = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (-2 x +x^{2}-2 \ln \left (-1+x \right )+2 c_1 \right ) \left (-1+x \right )}{2} \]
Mathematica. Time used: 0.038 (sec). Leaf size: 32
ode=D[y[x],x]+y[x]/(1-x)+2*x-x^2==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to (x-1) \left (\int _1^x\frac {(K[1]-2) K[1]}{K[1]-1}dK[1]+c_1\right ) \end{align*}
Sympy. Time used: 0.186 (sec). Leaf size: 32
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + 2*x + Derivative(y(x), x) + y(x)/(1 - x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} x - C_{1} + \frac {x^{3}}{2} - \frac {3 x^{2}}{2} - x \log {\left (x - 1 \right )} + x + \log {\left (x - 1 \right )} \]