SpecialFuncs.LegendreP Method

Overload List

#SignatureDescription
1function LegendreP(l: Integer; X: Double): Double;Legendre polynomial P(l,x) = P(l,0,x) (order m = 0).
2procedure LegendreP(n: Integer; X: Double; result: TDenseMtxVec);Vector of Legendre polynomials P(0,x), P(1,x), ..., P(n,x) (order m = 0).
3function LegendreP(l: Integer; m: Integer; X: Double): Double;Associated Legendre function P(l,m,x) (Condon-Shortley phase).
4function LegendreP(l: Integer; m: Integer; X: Single): Single;
5function LegendreP(l: Integer; X: Single): Single;
6procedure LegendreP(n: Integer; X: Single; result: TDenseMtxVec);

Overload 1: function LegendreP(l: Integer; X: Double): Double;

Legendre polynomial P(l,x) = P(l,0,x) (order m = 0).

#NameDescription
1XDefines value at which the Legendre polynomial will be evaluated. Valid x values are real values on the closed interval [-1,1]
2otherwise NaN is returned.
3lDefines the Legendre degree parameter l (integer, l >= 0).

Returns: Double - The Legendre polynomial P(l,x) = P(l,0,x), or NaN when |x| > 1.

Remarks:

Computes the ordinary Legendre polynomial of degree l, i.e. the associated Legendre function at order m = 0:

P_l(x)=1/(2^l l!)d^l/dx^l(x^2-1)^l, P_0=1, P_1=x, (l+1)P_(l+1)=(2l+1)x P_l-l P_(l-1).

Domain: integer l\ge 0 and real x on the closed interval [-1,1]. Defined behavior: returns NaN when |x|>1. Known values: P_l(1)=1 and P_l(-1)=(-1)^l.

Overload 2: procedure LegendreP(n: Integer; X: Double; result: TDenseMtxVec);

Vector of Legendre polynomials P(0,x), P(1,x), ..., P(n,x) (order m = 0).

#NameDescription
1XDefines value at which the Legendre polynomials will be evaluated. Valid x values are real values on the closed interval [-1,1].
2nDefines the highest degree to evaluate
3the result holds degrees 0..n (n must be >= 0).
4resultReturns the Legendre polynomials P(0,x), P(1,x), ..., P(n,x) in elements 0..n.

Result: stored in self (calling object)

Remarks:

Fills result with the sequence of ordinary Legendre polynomials evaluated at x:

result[l]=P_l(x), l=0,1,...,n,

using the three-term recurrence (l+1)P_{l+1}=(2l+1)x\,P_l-l\,P_{l-1} with P_0=1, P_1=x. The result operand is auto-sized to length n+1 and its precision matches the operand (single or double). Domain: integer n\ge 0 and real x on the closed interval [-1,1]. Defined behavior: an exception is raised if result is complex or if n<0; for |x|>1 each element follows the scalar contract (NaN).

Overload 3: function LegendreP(l: Integer; m: Integer; X: Double): Double;

Associated Legendre function P(l,m,x) (Condon-Shortley phase).

#NameDescription
1XDefines value at which the Legendre function will be evaluated. Valid x values are real values on the closed interval [-1,1]
2otherwise NaN is returned.
3lDefines the Legendre degree parameter l (integer, l >= 0).
4mDefines the Legendre order parameter m, an integer on the closed interval [0,l]
5otherwise NaN is returned.

Returns: Double - The associated Legendre function P(l,m,x) with the Condon-Shortley phase, or NaN when the parameters are out of domain.

Remarks:

Computes the associated Legendre function of degree l and order m, including the Condon-Shortley phase factor (-1)^m, by the standard upward recurrence in l. With P_l^m derived from the Legendre polynomial P_l by

P_l^m(x)=(-1)^m (1-x^2)^(m/2) d^m/dx^mP_l(x), m=0,1,...,l,

the function uses P_m^m(x)=(-1)^m(2m-1)!!\,(1-x^2)^{m/2}, P_{m+1}^m(x)=x\,(2m+1)\,P_m^m(x) and the recurrence (l-m)\,P_l^m=x(2l-1)P_{l-1}^m-(l+m-1)P_{l-2}^m.
Domain: integer l\ge 0, integer m on [0,l], and real x on the closed interval [-1,1]. Defined behavior on invalid input: if m<0, m>l, or |x|>1 the function returns NaN. The order-zero case P(l,0,x) equals the ordinary Legendre
polynomial P_l(x).

Overload 4: function LegendreP(l: Integer; m: Integer; X: Single): Single;

#NameTypeDescription
1lInteger
2mInteger
3XSinglescalar

Returns: Single

Overload 5: function LegendreP(l: Integer; X: Single): Single;

#NameTypeDescription
1lInteger
2XSinglescalar

Returns: Single

Overload 6: procedure LegendreP(n: Integer; X: Single; result: TDenseMtxVec);

#NameTypeDescription
1nInteger
2XSinglescalar
3resultTDenseMtxVecsource TVec or TMtx

Result: stored in self (calling object)