### 11.4.1 Legendre polynomials

The Legendre polynomial L(n,x) of degree n is a polynomial solution of the differential equation

(x2−1) y′′−2 x y′−n(n+1) y=0.

The Legendre polynomials satisfy the recurrence relation:

L(0,x) | =1 |  |  |  |  |  |  |  |  |
L(1,x) | =x |  |  |  |  |  |  |  |  |
L(n,x) |
= |
2n−1
n
| x L(n−1,x)− |
n−1
n
| L(n−2,x)

These polynomials are orthogonal for the scalar product:

⟨ f,g⟩= | ∫ |
1
−1
| f(x)g(x) d x.

The legendre command finds the Legendre polynomials.

- legendre takes one mandatory argument and one optional argument:
  - n, an integer.
  - Optionally, x, a variable name (by default x).
- legendre(n ⟨,x⟩) returns the Legendre polynomial of degree n.

#### Examples

legendre(4)

35
8
| x4− |
15
4
| x2+ |
3
8

legendre(4,y)

35
8
| y4− |
15
4
| y2+ |
3
8