pisces.math_utils.integration.integrate_mass#
- pisces.math_utils.integration.integrate_mass(profile, rr, **kwargs)[source]#
Compute enclosed mass profile via numerical integration.
For a density profile \(\rho(r)\), this evaluates:
\[M(r) = 4 \pi \int_0^r \rho(r') \; r'^2 \; dr'\]- Parameters:
profile (
callable
) – Function of radius \(r\) returning the density \(\rho(r)\) as a scalar or array.rr (
array-like
) – Radii at which to compute enclosed mass. Must be ascending and positive.**kwargs (
dict
, optional) – Additional keyword arguments passed toscipy.integrate.quad()
.
- Returns:
mass – Array of enclosed mass values at each radius.
- Return type:
ndarray