14 lines
530 B
Python

import numpy as np
def model_density_distribution(r_bins: np.ndarray, M: float = 5, a: float = 5) -> np.ndarray:
"""
Generate a density distribution for a spherical galaxy model, as per the Hernquist model.
Parameters:
- r_bins: The radial bins to calculate the density distribution for.
- M: The total mass of the galaxy.
- a: The scale radius of the galaxy.
See https://doi.org/10.1086%2F168845 for more information.
"""
rho = M / (2 * np.pi) * a / (r_bins * (r_bins + a)**3)
return rho