scipy/scipy — pull request #2800 by gertingold (2013-08-25 14:43:07+00:00)
Title: ensure analyticity of associate Legendre function of first kind

gh-2396 discusses the problem of phase factors in the Legendre function for complex arguments. In fact, the Legendre function of the first kind as it is implemented, exhibits phase jumps on the unit circle (cf. figure in https://github.com/scipy/scipy/pull/482#issuecomment-15509462) and thus is not analytic. This pull request proposes to introduce a new function `clpmn` which provides an analytic associated Legendre function of the first kind. The existing function `lpmn` in the new version raises an exception if used for complex arguments. The present implementation follows the conventions stated in http://dlmf.nist.gov/14.21 with a cut on the interval `(-inf,1]`. Some tests have been added to `test_basic.py` focusing on the behavior close to the real axis and close to the unit circle. The latter tests the absence of phase jumps which were present before. Also, one test in `test_mpmath.py` has been adapted to the new function.

If the code proposed here is accepted, the documentation needs to be adapted. In particular, it should point out the existence of a phase factor with respect to Ferrer's function of the first kind as the real axis is approached (cf. http://dlmf.nist.gov/14.23#E1). Furthermore, a corresponding implementation for the associated Legendre polynomial of the second kind will be needed. This could go into a new function `clqmn`.