def density_energy_electron(spectrum, gamma):
"""
Calculate the energy density of relativistic electrons.
Parameters
----------
spectrum : 1D float `~numpy.ndarray`
The number density of the electrons w.r.t. Lorentz factors
Unit: [cm^-3]
gamma : 1D float `~numpy.ndarray`
The Lorentz factors of electrons
Returns
-------
e_re : float
The energy density of the relativistic electrons.
Unit: [erg cm^-3]
"""
e_re = integrate.trapz(spectrum*gamma*AU.mec2, gamma)
return e_re
评论列表
文章目录