4.7.20 \(x (x+1) y'(x)=\left (x^2+x-1\right ) y(x)+(x+1) \left (x^2-1\right )\)

ODE
\[ x (x+1) y'(x)=\left (x^2+x-1\right ) y(x)+(x+1) \left (x^2-1\right ) \] ODE Classification

[_linear]

Book solution method
Linear ODE

Mathematica
cpu = 0.196254 (sec), leaf count = 22

\[\left \{\left \{y(x)\to -\frac {(x+1) \left (x-c_1 e^x\right )}{x}\right \}\right \}\]

Maple
cpu = 0.013 (sec), leaf count = 19

\[\left [y \left (x \right ) = \frac {{\mathrm e}^{x} \left (1+x \right ) \textit {\_C1}}{x}-x -1\right ]\] Mathematica raw input

DSolve[x*(1 + x)*y'[x] == (1 + x)*(-1 + x^2) + (-1 + x + x^2)*y[x],y[x],x]

Mathematica raw output

{{y[x] -> -(((1 + x)*(x - E^x*C[1]))/x)}}

Maple raw input

dsolve(x*(1+x)*diff(y(x),x) = (1+x)*(x^2-1)+(x^2+x-1)*y(x), y(x))

Maple raw output

[y(x) = exp(x)/x*(1+x)*_C1-x-1]