Home Libraries People FAQ More

#### 勒讓德 (及連帶) 多項式

##### 概要

```#include <boost/math/special_functions/legendre.hpp>
```

```namespace boost{ namespace math{

template <class T>
calculated-result-type legendre_p(int n, T x);

template <class T, class Policy>
calculated-result-type legendre_p(int n, T x, const Policy&);

template <class T>
calculated-result-type legendre_p(int n, int m, T x);

template <class T, class Policy>
calculated-result-type legendre_p(int n, int m, T x, const Policy&);

template <class T>
calculated-result-type legendre_q(unsigned n, T x);

template <class T, class Policy>
calculated-result-type legendre_q(unsigned n, T x, const Policy&);

template <class T1, class T2, class T3>
calculated-result-type legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1);

template <class T1, class T2, class T3>
calculated-result-type legendre_next(unsigned l, unsigned m, T1 x, T2 Pl, T3 Plm1);

}} // namespaces
```

##### 說明
```template <class T>
calculated-result-type legendre_p(int l, T x);

template <class T, class Policy>
calculated-result-type legendre_p(int l, T x, const Policy&);
```

P-l-1(x) = Pl(x)

```template <class T>
calculated-result-type legendre_p(int l, int m, T x);

template <class T, class Policy>
calculated-result-type legendre_p(int l, int m, T x, const Policy&);
```

lm 的情況使用恆等關係來處理:

注意 這裡所使用的連帶勒讓德多項式的定義包含一個前導的位相(-1)m。這與Abramowitzt和Stegun(8.6.6)給定的定義相符合，並且被Mathworld和 Mathematica's 勒讓德 P 函數使用。然而，在這些使用的定義並沒有一直包含這個前導的位相，同時，比較奇怪的是C++ TR1 (assoc_legendre) 也忽略了這一點，除了說明使用Abramowitz和Stegun作為這些問題的權威參考. 參見: Abramowitz, M. and Stegun, I. A. (Eds.). "Legendre Functions" and "Orthogonal Polynomials." Ch. 22 in Chs. 8 and 22 in Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, 9th printing. New York: Dover, pp. 331-339 and 771-802, 1972.
```template <class T>
calculated-result-type legendre_q(unsigned n, T x);

template <class T, class Policy>
calculated-result-type legendre_q(unsigned n, T x, const Policy&);
```

```template <class T1, class T2, class T3>
calculated-result-type legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1);
```

```double x = 0.5;  // 橫坐標值
vector<double> v;
v.push_back(legendre_p(0, x)).push_back(legendre_p(1, x));
for(unsigned l = 1; l < 10; ++l)
v.push_back(legendre_next(l, x, v[l], v[l-1]));
```

l

x

Pl

Plm1

```template <class T1, class T2, class T3>
calculated-result-type legendre_next(unsigned l, unsigned m, T1 x, T2 Pl, T3 Plm1);
```

```double x = 0.5;  // 橫坐標
int m = 10;      // 次數
vector<double> v;
v.push_back(legendre_p(m, m, x)).push_back(legendre_p(1 + m, m, x));
for(unsigned l = 1 + m; l < m + 10; ++l)
v.push_back(legendre_next(l, m, x, v[l], v[l-1]));
```

l

m

x

Pl

Plm1

##### 精確性

0 < l < 20

20 < l < 120

53

Win32, Visual C++ 8

64

SUSE Linux IA32, g++ 4.1

64

Red Hat Linux IA64, g++ 3.4.4

113

HPUX IA64, aCC A.06.06

0 < l < 20

53

Win32, Visual C++ 8

64

SUSE Linux IA32, g++ 4.1

64

Red Hat Linux IA64, g++ 3.4.4

113

HPUX IA64, aCC A.06.06

0 < l < 20

20 < l < 120

53

Win32, Visual C++ 8

64

SUSE Linux IA32, g++ 4.1

64

Red Hat Linux IA64, g++ 3.4.4

113

HPUX IA64, aCC A.06.06