gauss

iadpython.quadrature.gauss(n, a=-1, b=1)[source]

Return abscissas and weights for Gaussian quadrature.

The definite integral ranges from a to b. The default interval is -1 to 1. The quadrature approximation is just the sum of \(w_i f(x_i)\). Neither a nor b is included in the list of quadrature abscissas.

The result should be exact when integrating any polynomial of degree 2n-1 or less.

If -a=b, then abscissas will be symmetric about the origin

Parameters:
  • n – number of quadrature points

  • a – lower limit of integral

  • b – upper limit of integral

Returns:

x – array of abscissas of length n w: array of weights of length n