Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Legendre Polynomial P_n(x) Table
P3(x)
101 points computed by Bonnet's recursion
Degree n 3
Rows 101
First value P_n(x_0) -1
Last value P_n(x_last) 1
x P_n(x)
-1 -1
-0.98 -0.88298
-0.96 -0.77184
-0.94 -0.66646
-0.92 -0.56672
-0.9 -0.4725
-0.88 -0.38368
-0.86 -0.30014
-0.84 -0.22176
-0.82 -0.14842
-0.8 -0.08
-0.78 -0.01638
-0.76 0.04256
-0.74 0.09694
-0.72 0.14688
-0.7 0.1925
-0.68 0.23392
-0.66 0.27126
-0.64 0.30464
-0.62 0.33418
-0.6 0.36
-0.58 0.38222
-0.56 0.40096
-0.54 0.41634
-0.52 0.42848
-0.5 0.4375
-0.48 0.44352
-0.46 0.44666
-0.44 0.44704
-0.42 0.44478
-0.4 0.44
-0.38 0.43282
-0.36 0.42336
-0.34 0.41174
-0.32 0.39808
-0.3 0.3825
-0.28 0.36512
-0.26 0.34606
-0.24 0.32544
-0.22 0.30338
-0.2 0.28
-0.18 0.25542
-0.16 0.22976
-0.14 0.20314
-0.12 0.17568
-0.1 0.1475
-0.08 0.11872
-0.06 0.08946
-0.04 0.05984
-0.02 0.02998
0 -0
0.02 -0.02998
0.04 -0.05984
0.06 -0.08946
0.08 -0.11872
0.1 -0.1475
0.12 -0.17568
0.14 -0.20314
0.16 -0.22976
0.18 -0.25542
0.2 -0.28
0.22 -0.30338
0.24 -0.32544
0.26 -0.34606
0.28 -0.36512
0.3 -0.3825
0.32 -0.39808
0.34 -0.41174
0.36 -0.42336
0.38 -0.43282
0.4 -0.44
0.42 -0.44478
0.44 -0.44704
0.46 -0.44666
0.48 -0.44352
0.5 -0.4375
0.52 -0.42848
0.54 -0.41634
0.56 -0.40096
0.58 -0.38222
0.6 -0.36
0.62 -0.33418
0.64 -0.30464
0.66 -0.27126
0.68 -0.23392
0.7 -0.1925
0.72 -0.14688
0.74 -0.09694
0.76 -0.04256
0.78 0.01638
0.8 0.08
0.82 0.14842
0.84 0.22176
0.86 0.30014
0.88 0.38368
0.9 0.4725
0.92 0.56672
0.94 0.66646
0.96 0.77184
0.98 0.88298
1 1

What this calculator does

This tool builds a table of values for the Legendre polynomial \(P_n(x)\) for a chosen degree \(n\), evaluated over a sequence of x values, and draws the corresponding curve. You pick the degree, a starting x, a step increment, and how many rows you want; the calculator returns each pair \((x, P_n(x))\) plus a line plot. Legendre polynomials are a classic family of orthogonal polynomials on the interval [-1, 1] and appear throughout physics and applied mathematics — in solutions of Laplace's equation, multipole expansions, spherical harmonics, and Gaussian quadrature.

Curves of the first few Legendre polynomials plotted on x from minus one to one
The first several Legendre polynomials P_n(x) on the interval [-1, 1].

How to use it

Enter n (degree) as a non-negative integer (0, 1, 2, …). Set the initial value of x (often -1), the increment (step) between successive x values (e.g. 0.02), and the number of repetitions (rows) you want generated. The i-th row uses \(x = \text{startX} + i \times \text{step}\). Although the polynomials are most meaningful on [-1, 1], the formula works for any real x — note that outside that interval the magnitude grows quickly.

The formula explained

Rather than expanding closed forms, the calculator uses Bonnet's recursion for numerical stability: start with \(P_0(x) = 1\) and \(P_1(x) = x\), then iterate

$$P_{k+1}(x) = \frac{(2k+1)\cdot x\cdot P_k(x) - k\cdot P_{k-1}(x)}{k+1}.$$

The first closed forms are \(P_2 = \frac{3x^2 - 1}{2}\), \(P_3 = \frac{5x^3 - 3x}{2}\), and \(P_4 = \frac{35x^4 - 30x^2 + 3}{8}\).

Diagram showing Bonnet recursion combining two previous polynomials into the next
Bonnet's recursion builds each polynomial from the two before it.

Worked example

For \(n = 3\) at \(x = 0.5\): \(P_0 = 1\), \(P_1 = 0.5\). Then

$$P_2 = \frac{3\cdot 0.5\cdot 0.5 - 1}{2} = -0.125,$$$$P_3 = \frac{5\cdot 0.5\cdot(-0.125) - 2\cdot 0.5}{3} = \frac{-1.3125}{3} = -0.4375.$$

The closed form \(\frac{5x^3 - 3x}{2}\) gives the same result, confirming the recursion.

FAQ

What does n = 0 give? A constant value of 1 for every x, so the graph is a flat horizontal line. What are the endpoint values? Every Legendre polynomial satisfies \(P_n(1) = 1\) and \(P_n(-1) = (-1)^n\). Why use the recursion instead of explicit formulas? The three-term recurrence is fast and numerically stable for arbitrary degree, avoiding the cancellation errors of high-order explicit polynomials.

Last updated: