##### 4.7.1 $$\left (1-x^2\right ) y'(x)=n \left (y(x)^2-2 x y(x)+1\right )$$

ODE
$\left (1-x^2\right ) y'(x)=n \left (y(x)^2-2 x y(x)+1\right )$ ODE Classiﬁcation

[_rational, _Riccati]

Book solution method
Riccati ODE, Generalized ODE

Mathematica
cpu = 0.380458 (sec), leaf count = 32

$\left \{\left \{y(x)\to \frac {Q_n(x)+c_1 P_n(x)}{Q_{n-1}(x)+c_1 P_{n-1}(x)}\right \}\right \}$

Maple
cpu = 0.329 (sec), leaf count = 231

$\left [y \left (x \right ) = \frac {8 \textit {\_C1} \left (\left (n -\frac {1}{2}\right ) x -\frac {n}{2}+\frac {1}{2}\right ) \left (1+x \right ) \HeunC \left (0, -2 n +1, 0, 0, n^{2}-n +\frac {1}{2}, \frac {2}{1+x}\right )-n \left (-\frac {x}{2}-\frac {1}{2}\right )^{-2 n +1} \left (1+x \right ) \HeunC \left (0, 2 n -1, 0, 0, n^{2}-n +\frac {1}{2}, \frac {2}{1+x}\right )-8 \left (\HeunCPrime \left (0, -2 n +1, 0, 0, n^{2}-n +\frac {1}{2}, \frac {2}{1+x}\right ) \textit {\_C1} -\frac {\left (-\frac {x}{2}-\frac {1}{2}\right )^{-2 n +1} \HeunCPrime \left (0, 2 n -1, 0, 0, n^{2}-n +\frac {1}{2}, \frac {2}{1+x}\right )}{4}\right ) \left (x -1\right )}{4 \left (\HeunC \left (0, -2 n +1, 0, 0, n^{2}-n +\frac {1}{2}, \frac {2}{1+x}\right ) \textit {\_C1} -\frac {\left (-\frac {x}{2}-\frac {1}{2}\right )^{-2 n +1} \HeunC \left (0, 2 n -1, 0, 0, n^{2}-n +\frac {1}{2}, \frac {2}{1+x}\right )}{4}\right ) \left (1+x \right ) n}\right ]$ Mathematica raw input

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

Mathematica raw output

{{y[x] -> (C[1]*LegendreP[n, x] + LegendreQ[n, x])/(C[1]*LegendreP[-1 + n, x] +
LegendreQ[-1 + n, x])}}

Maple raw input

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

Maple raw output

[y(x) = 1/4*(8*_C1*((n-1/2)*x-1/2*n+1/2)*(1+x)*HeunC(0,-2*n+1,0,0,n^2-n+1/2,2/(1
+x))-n*(-1/2*x-1/2)^(-2*n+1)*(1+x)*HeunC(0,2*n-1,0,0,n^2-n+1/2,2/(1+x))-8*(HeunC
Prime(0,-2*n+1,0,0,n^2-n+1/2,2/(1+x))*_C1-1/4*(-1/2*x-1/2)^(-2*n+1)*HeunCPrime(0
,2*n-1,0,0,n^2-n+1/2,2/(1+x)))*(x-1))/(HeunC(0,-2*n+1,0,0,n^2-n+1/2,2/(1+x))*_C1
-1/4*(-1/2*x-1/2)^(-2*n+1)*HeunC(0,2*n-1,0,0,n^2-n+1/2,2/(1+x)))/(1+x)/n]