Skip to content

lintegrate

Compare
Choose a tag to compare
@mattpitkin mattpitkin released this 19 Jul 21:05
· 136 commits to master since this release

A numerical integration library for when you want/need to work with the natural logarithm of the function requiring integration.

This library provides three numerical integration functions, heavily based on GSL functions, to integrate a function when only its natural logarithm is given, and return the natural logarithm of that integral. The three functions:

  • lintegrate_qag
  • lintegrate_qng
  • lintegrate_cquad

are equivalents of the GSL functions:

respectively. These can be useful when, e.g., you have a log Gaussian likelihood function (in cases where the exponentiation of the Gaussian function would lead to zeros or infinities) and you want to numerically find the integral of the Gaussian function itself.

The functions lintegrate_qag, lintegrate_qng, and lintegrate_cquad, all have wrappers functions (with _split appended to their names) that allow the user to specify a set of intervals that the integrals will be split into when performing the calculation. The intervals could, for example, be spaced evenly in log-space, for cases where the integral function has a very pronounced peak as it approaches zero.

A python package, also called lintegrate, is also provided, which gives access to the C library functions.