relife.utils.gauss_legendre

relife.utils.gauss_legendre

relife.utils.gauss_legendre(func: Callable, a: numpy.ndarray, b: numpy.ndarray, *args: numpy.ndarray, ndim: int = 0, deg: int = 100) numpy.ndarray[source]

Gauss-Legendre integration.

Parameters
  • func (Callable) – The function to be integrated.

  • a (float or ndarray.) – The lower bound of integration.

  • b (float or 1D array.) – The upper bound of integration.

  • *args (float or 2D array, optional) – Extra arguments required by the function func.

  • ndim (int, optional) – Number of dimensions of the func, by default 0.

  • deg (int, optional) – Degree of the Legendre polynomials (see numpy.polynomial.legendre.leggauss documentation), by default 100.

Returns

The numerical integration of func from a to b.

Return type

ndarray

Notes

It is a numerical integration of:

\[\int_a^b f(x) \mathrm{d} x\]