[Python] How to understand the type of Legendre function defined in both mpmath and Mathematica

Discussão em 'Python' iniciado por Stack, Março 29, 2025.

  1. Stack

    Stack Membro Participativo

    I am working on a problem which involved the associated Legendre function of the first and second kind, of order one and half integer degree, denoted as P_{n-1/2}^1(z) and Q_{n-1/2}^1(z), here n is integer and goes from 0 to a certain positive integer.

    For my current problem, z is always bigger than 1.

    I tried with both mpmath and Mathematica and they deliver the same results. BUT the result is complex numbers which is out of expectation because I am calculating some real physical quantites.

    I was stuck for a while and today I read there is actually a hidden parameter for both P and Q in mpmath and Mathematica, that is the type of the branch cut.

    https://reference.wolfram.com/language/ref/LegendreP.html

    https://mpmath.org/doc/current/functions/orthogonal.html

    I tried to use type 3 and now the result is essentially real numbers with negligible imaginary part. So my question is what is this branch cut and how to choose the correct type?

    Continue reading...

Compartilhe esta Página