40
3 Legendre Polynomials and Legendre Functions
Direct Computation
For evaluating the Legendre polynomials, the methods polyvalue and, respectively,
Qvalue are used. Both are based on the MATLAB function polyval. Arithmetic
among numbers in floating point representation is not exact. (Only arithmetic in
integer representation is exact.) Any arithmetic operation among floating numbers
will cause a round-off error. The polynomial representation of Legendre polynomials uncovers best their structure. But firstly, to derive the Legendre polynomial and
then to evaluate this Legendre polynomial at position x will be less accurate than the
direct evaluation based on the recurrence relation (3.5). Figure 3.2 shows the relative
deviation between the direct computation based on the recurrence relation (3.5) and
the evaluation of the corresponding Legendre polynomial.
The class Pl0 evaluates the polynomial values of the Legendre polynomial of
first kind and second kind based on Eq. (3.5). Starting point of the computation are
the values for l = 0 and l = 1. The syntax to compute the polynomial values
is obj = Pl0(l,x,w), e.g., y = Pl0(23,randn(2,3),3).value. “l”
is the degree of the Legendre polynomial, “x” an arbitrary complex array of type
double at which the polynomials will be evaluated, and “w” (optional) if the
Legendre polynomials of 1st kind (default, w = 1) will be computed or second kind
(w = 2) or both (w = 3). y = Pl0(...).value returns a structure with fields
“P00” to “Pl0” and/or “Q00” to “Ql0” containing the corresponding polynomial
values with the same array structure as “x”; “obj” is the object of the class Pl0
with property “y.” An application example (partial wave expansion in Coulomb
scattering) can be found in Sect. 7.3.1.
Nodes of the Legendre Polynomials
By orthonormalizing the Legendre polynomials, Eq. (3.4), P l →
√
(2l + 1)/2P l =
˜
P l , we arrive at the recurrence relation
x ˜
P l (x) =
l + 1
2l + 1
2l + 1
2l + 3
˜
P l+1 +
l
2l + 1
2l + 1
2l − 1
˜
P l−1 ,
(3.7)
Fig. 3.2 Relative deviation
Δ rel between the computation
based on the recurrence
relation (3.5) and the
evaluation of the
corresponding Legendre
polynomial for
P 25,28,31,34,37 (x) and P 40 (x)
for −1 ≤ x ≤ 1
-1
-0.8 -0.6 -0.4 -0.2
0
0.2
0.4
0.6
0.8
1
x
10
-20
10
-15
10
-10
10
-5
10
0
rel
25
28
34
37
40
31
Précédent

- 55/287

Suivant