MATLAB: Associated legendre functions matlab

associated legendrelegendre

In the function legendre(1,-0.7071), the value corresponding to P11(-0.7071) is coming wrong when checked with standard solutions. Matlab is giving the solution as -0.7071. whereas, the actual solution is +0.7071. Please have a look at it. Or please suggest me how to correct it.
One can verify using online calculator in the link. https://keisan.casio.com/exec/system/1287453184

Best Answer

Hi chaitanya,
It's apples and oranges. When the domain of the argument is -1 <= x <= 1, the function is -sqrt(1-x^2). That's what Matlab is doing, and that's what it says it is doing. When the domain is opened up, 0 <= theta < 2pi with x = cos(theta), then the function can become -sin(theta). Both results are in Wikipedia.