pisces.math_utils.integration.integrate#
- pisces.math_utils.integration.integrate(profile, rr, rmax=None, **kwargs)[source]#
Compute cumulative integral from each radius \(r\) to \(r_{\mathrm{max}}\).
Evaluates:
\[I(r) = \int_{r}^{r_{\mathrm{max}}} f(r') \; dr'\]- Parameters:
profile (
callable
) – Function of radius \(r\) returning the integrand \(f(r)\).rr (
array-like
) – Radii at which to compute cumulative integrals. Must be sorted ascending.rmax (
float
orNone
, optional) – Upper bound of integration. If None, defaults torr[-1]
.**kwargs (
dict
, optional) – Additional keyword arguments passed toscipy.integrate.quad()
.
- Returns:
integral – Array of integral values \(I(r)\) for each radius in
rr
.- Return type:
ndarray
- Raises:
ValueError – If any radius in
rr
exceedsrmax
.