4.27.17 \(a \cot (x) y'(x)+y(x) \left (b+k^2 \cos ^2(x)\right )+y''(x)=0\)

ODE
\[ a \cot (x) y'(x)+y(x) \left (b+k^2 \cos ^2(x)\right )+y''(x)=0 \] ODE Classification

[[_2nd_order, _with_linear_symmetries]]

Book solution method
TO DO

Mathematica
cpu = 1.06933 (sec), leaf count = 0 , could not solve

DSolve[(b + k^2*Cos[x]^2)*y[x] + a*Cot[x]*Derivative[1][y][x] + Derivative[2][y][x] == 0, y[x], x]

Maple
cpu = 0.383 (sec), leaf count = 77

\[ \left \{ y \left ( x \right ) ={\it \_C1}\,{\it HeunC} \left ( 0,{\frac {a}{2}}-{\frac {1}{2}},-{\frac {1}{2}},{\frac {{k}^{2}}{4}},-{\frac {a}{8}}+{\frac {3}{8}}-{\frac {{k}^{2}}{4}}-{\frac {b}{4}}, \left ( \sin \left ( x \right ) \right ) ^{2} \right ) +{\it \_C2}\,{\it HeunC} \left ( 0,-{\frac {a}{2}}+{\frac {1}{2}},-{\frac {1}{2}},{\frac {{k}^{2}}{4}},-{\frac {a}{8}}+{\frac {3}{8}}-{\frac {{k}^{2}}{4}}-{\frac {b}{4}}, \left ( \sin \left ( x \right ) \right ) ^{2} \right ) \left ( \sin \left ( x \right ) \right ) ^{1-a} \right \} \] Mathematica raw input

DSolve[(b + k^2*Cos[x]^2)*y[x] + a*Cot[x]*y'[x] + y''[x] == 0,y[x],x]

Mathematica raw output

DSolve[(b + k^2*Cos[x]^2)*y[x] + a*Cot[x]*Derivative[1][y][x] + Derivative[2][y]
[x] == 0, y[x], x]

Maple raw input

dsolve(diff(diff(y(x),x),x)+a*cot(x)*diff(y(x),x)+(b+k^2*cos(x)^2)*y(x) = 0, y(x),'implicit')

Maple raw output

y(x) = _C1*HeunC(0,1/2*a-1/2,-1/2,1/4*k^2,-1/8*a+3/8-1/4*k^2-1/4*b,sin(x)^2)+_C2
*HeunC(0,-1/2*a+1/2,-1/2,1/4*k^2,-1/8*a+3/8-1/4*k^2-1/4*b,sin(x)^2)*sin(x)^(1-a)