The electron mass is an extremely small number in SI units, kilograms, which is why particle physics conventionally often expresses masses in different units, like electron volts divided by the speed of light squared, instead. scipy.constants also provides this same value under the shorter alias constants.m_e, and both names refer to the identical CODATA-recommended value.
1Understanding constants.electron_mass
The electron mass is an extremely small number in SI units, kilograms, which is why particle physics conventionally often expresses masses in different units, like electron volts divided by the speed of light squared, instead. scipy.constants also provides this same value under the shorter alias constants.m_e, and both names refer to the identical CODATA-recommended value.
scipy.constants.electron_mass and scipy.constants.m_e are the exact same value under two different names — use whichever reads more clearly in your specific code, the longer, more explicit name or the shorter, conventional physics symbol.
from scipy import constants
print(constants.electron_mass)2Practical Example
Here is a real-world application of constants.electron_mass showing how it is used in production SciPy code.
from scipy import constants
velocity = 0.1 * constants.c
kinetic_energy = 0.5 * constants.electron_mass * velocity ** 2
print(f"{kinetic_energy:.3e} joules")3Best Practices
Follow these guidelines when working with constants.electron_mass:
1. Use the named constant instead of hardcoding the electron mass's tiny numeric value directly in code
2. Be mindful of unit conversions when working with atomic-scale masses, since kilograms are an inconveniently large unit for values this small
3. Check scipy.constants.physical_constants for the associated measurement uncertainty if working precision at this atomic scale matters
Tip: scipy.constants.electron_mass and scipy.constants.m_e are the exact same value under two different names — use whichever reads more clearly in your specific code, the longer, more explicit name or the shorter, conventional physics symbol.
from scipy import constants
print(constants.electron_mass)