FLINT3.7.0-dev

acb_hypgeom_legendre_p

Synopsis#include <flint/acb_hypgeom.h>
void acb_hypgeom_legendre_p(acb_t res, const acb_t n, const acb_t m, const acb_t z, int type, slong prec)source

Sets res to the associated Legendre function of the first kind of degree n, order m and argument z; for m = 0 this is the Legendre polynomial P_n(z). Several branch cut conventions are in use. If type is 0, the function is

P_n^m(z) = \frac{(1+z)^{m/2}}{(1-z)^{m/2}}\, \mathbf{F}\left(-n, n+1, 1-m, \frac{1-z}{2}\right),

with cuts (-\infty, -1] and [1, \infty), and if type is 1, the function is

{\mathcal P}_n^m(z) = \frac{(z+1)^{m/2}}{(z-1)^{m/2}}\, \mathbf{F}\left(-n, n+1, 1-m, \frac{1-z}{2}\right),

with the cut (-\infty, 1]. Type 0 and type 1 correspond to type 2 and type 3 in Mathematica and mpmath; other values of type raise an exception.

For real z, m = 0 and a nonnegative word-size integer n, the function calls arb_hypgeom_legendre_p_ui. For integers 0 \le m \le n and type 0 it evaluates (1-z^2)^{m/2} times the polynomial of acb_hypgeom_legendre_p_uiui_rec at low precision, near z = 1, or for small n - m; if n - m > 2\,\mathit{prec} the result is indeterminate, since the recurrence would lose all accuracy. Otherwise the hypergeometric representation is evaluated with acb_hypgeom_2f1.

Cite this page

The FLINT team, “acb_hypgeom_legendre_p (acb_hypgeom.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/acb_hypgeom/acb_hypgeom_legendre_p.html (generated 2026-10-20).