archimedes.quadrature.gauss_legendreΒΆ

archimedes.quadrature.gauss_legendre(
n: int,
a: float | None = None,
b: float | None = None,
) → QuadratureRuleΒΆ

Gauss-Legendre quadrature rule with n nodes.

Nodes are the roots of the degree-n Legendre polynomial \(P_n(x)\), none of which coincide with the endpoints \(\pm 1\). The rule is exact for polynomials up to degree \(2n - 1\).

Parameters:
  • n (int) – Number of quadrature nodes.

  • a (float, optional) – Bounds of the target interval, forwarded to map_to(). Must both be given, or neither (the default, giving the reference interval \([-1, 1]\)).

  • b (float, optional) – Bounds of the target interval, forwarded to map_to(). Must both be given, or neither (the default, giving the reference interval \([-1, 1]\)).

Returns:

rule – Gauss-Legendre rule with n nodes on \([-1, 1]\), exact to degree \(2n - 1\), mapped onto \([a, b]\) if given.

Return type:

QuadratureRule