Qu

legendre

Builtin index · Core maths

legendre(n, x)

Input: n, x · Output: no output

What it is

Associated Legendre functions P_n^m(x) for m = 0..n, unnormalised and with the Condon-Shortley phase (-1)^m, as MATLAB. n is a non-negative whole number (at most 100000); a number x in [-1, 1] gives a Vec of n + 1 values (entry m is P_n^m(x)), a vector x of length k gives an (n+1)×k Mat (row m). By the upward recurrence in degree, worst relative error 2e-14 against mpmath for n = 6 and n = 40; entries too large for a double (high m once n passes about 150) become inf. For example legendre(2, 0.5) is [-0.125, -1.299038..., 2.25]. Errors: x outside [-1, 1], a non-integer or negative n, a matrix x.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
legendre(n, x)
n numbern is a non-negative whole number (at most 100000).
x —Associated Legendre functions P_n^m(x) for m = 0..n, unnormalised and with the Condon-Shortley phase (-1)^m, as MATLAB.
not documented yetFor example legendre(2, 0.5) is [-0.125, -1.299038..., 2.25].

Examples

No documentation example calls this form yet. The Core maths chapter is where one belongs.