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 nn, order mm and argument zz; for m=0m = 0 this is the Legendre polynomial Pn(z)P_n(z). Several branch cut conventions are in use. If type is 0, the function is

Pnm(z)=(1+z)m/2(1−z)m/2 F(−n,n+1,1−m,1−z2),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 (−∞,−1](-\infty, -1] and [1,∞)[1, \infty), and if type is 1, the function is

Pnm(z)=(z+1)m/2(z−1)m/2 F(−n,n+1,1−m,1−z2),{\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 (−∞,1](-\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 zz, m=0m = 0 and a nonnegative word-size integer nn, the function calls arb_hypgeom_legendre_p_ui. For integers 0≤m≤n0 \le m \le n and type 0 it evaluates (1−z2)m/2(1-z^2)^{m/2} times the polynomial of acb_hypgeom_legendre_p_uiui_rec at low precision, near z=1z = 1, or for small n−mn - m; if n−m>2 precn - 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-11-02).