pisces.math_utils.integration.integrate_toinf#
- pisces.math_utils.integration.integrate_toinf(profile, rr, rmax=None, **kwargs)[source]#
Compute cumulative integral from each radius \(r\) to infinity.
Evaluates:
\[I(r) = \int_{r}^{\infty} f(r') \; dr'\]The integration is performed in two parts:
From \(r\) to \(r_{\mathrm{max}}\).
From \(r_{\mathrm{max}}\) to \(\infty\) (computed once and added to all results).
- 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 for intermediate 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
.