naginterfaces.library.specfun.legendre_​p

naginterfaces.library.specfun.legendre_p(mode, x, m, nl)[source]

legendre_p returns a sequence of values for either the unnormalized or normalized Legendre functions of the first kind or for real of a given order and degree .

For full information please refer to the NAG Library document for s22aa

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/s/s22aaf.html

Parameters
modeint

Indicates whether the sequence of function values is to be returned unnormalized or normalized.

The sequence of function values is returned unnormalized.

The sequence of function values is returned normalized.

xfloat

The argument of the function.

mint

The order of the function.

nlint

The degree of the last function required in the sequence.

Returns
pfloat, ndarray, shape

The required sequence of function values as follows:

if , contains , for ;

if , contains , for .

Raises
NagValueError
(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: when , .

(errno )

On entry, .

Constraint: when .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Notes

legendre_p evaluates a sequence of values for either the unnormalized or normalized Legendre () or associated Legendre () functions of the first kind or , where is real with , of order and degree defined by

respectively; is the (unassociated) Legendre polynomial of degree given by

(the Rodrigues formula). Note that some authors (e.g., Abramowitz and Stegun (1972)) include an additional factor of (the Condon–Shortley Phase) in the definitions of and . They use the notation in order to distinguish between the two cases.

legendre_p is based on a standard recurrence relation described in Section 8.5.3 of Abramowitz and Stegun (1972). Constraints are placed on the values of and in order to avoid the possibility of machine overflow. It also sets the appropriate elements of the array (see Parameters) to zero whenever the required function is not defined for certain values of and (e.g., and ).

References

Abramowitz, M and Stegun, I A, 1972, Handbook of Mathematical Functions, (3rd Edition), Dover Publications