keisoku

Gauss-Legendre Nodes and Weights

Enter a degree n to compute the Gauss-Legendre quadrature nodes x_i and weights w_i on the standard interval [-1, 1] and list them in a table.

Input

Enter a degree n to compute the Gauss-Legendre quadrature nodes x_i and weights w_i on the standard interval [-1, 1].

Number of nodes (1–256)

Result

Degree n

5

Nodes and weights on the standard interval [-1, 1]

Number of nodes

5

Sum of weights

2

Interval

[-1, 1]

Nodes and weights

Shows the nodes x_i (roots of the Legendre polynomial) and weights w_i on the standard interval [-1, 1].

#Node x_iWeight w_i
1-0.53846931010.4786286705
2-0.90617984590.2369268851
300.5688888889
40.90617984590.2369268851
50.53846931010.4786286705

How it works

  • The nodes x_i are the roots of the degree-n Legendre polynomial P_n(x), computed on the standard interval [-1, 1].
  • Roots are found by Newton's method using the asymptotic initial guess cos(π(i+3/4)/(n+1/2)), with derivative P_n'(x)=n(xP_n(x)−P_{n-1}(x))/(x²−1).
  • Weights are computed as w_i = 2 / ((1 − x_i²) (P_n'(x_i))²). Nodes are assembled using the even/odd symmetry of P_n.
  • The sum of the weights equals 2 in theory (the length of [-1, 1]), which serves as an accuracy check.
  • To use an arbitrary interval [a, b], map x = (b−a)/2·t + (a+b)/2 and scale weights by (b−a)/2.

Reviews

Tell us what you think of this calculator.

Write a review

  1. Home
  2. Gauss-Legendre Nodes and Weights