NaturalUnits
is a Mathematica package for working with the natural units, that is, unit systems where a number of physical constants are set to one. For example, in cosmology, it is common to use units with c = ħ = kB = 1. These units are convenient to do computations with, but in the end, one wants to convert the results back to physical units. The package performs such conversions. This page contains examples of its use, download links, and further resources.
Load the package into a notebook (assuming NaturalUnits.m
is in the notebook folder):
In: SetDirectory[NotebookDirectory[]];
<< "NaturalUnits.m"
NaturalUnitsSetup[NewUnitSystem->CosmologyUnits, NewNatUnits->{eV}]; (* Omit in v1.0 *)
Out: NaturalUnits 2.0
The file NaturalUnits.m
can also be added into one of the folders listed under $Path
in Mathematica to make it automatically available. Then, the command SetDirectory
is not necessary.
Checks and info:
In: ?MP
Out: reduced Planck mass
In: NaturalUnitsCheck[MP]
Out: Unit 'MP' exists as MP=2.43538*10^27 eV
Original definition: MP=Sqrt[(c hbar)/G]/(2 Sqrt[2 \[Pi]])
Basic examples:
In: NaturalConvert[kg]
Out: 5.60959*10^35 eV
In: NaturalConvert[mm, Hz]
Out: 3.33564*10^-12/Hz
In: NaturalConvert[MP, K]
Out: 2.82614*10^31 K
Computation of the number of nucleons in the Sun:
In: NaturalConvert[MSolar, GeV, KeepUnit->False] (* "KeepUnit->False" drops mass unit *)
Out: 1.11575*10^57
How many humans, weighing roughly 100 kg each, this corresponds to:
In: NaturalConvert[MSolar, 100kg, KeepUnit->Defer] (* "KeepUnit->Defer" keeps target unit intact *)
Out: 1.989*10^28 (100 kg)
Number density of solar mass black holes near the Solar System if they make up all dark matter, starting from the local dark matter density 0.3 GeV/cm3:
In: NaturalConvert[0.3 GeV/cm^3/MSolar, 1/pc^3]
Out: 0.00789964/pc^3
Average density of the universe, starting from the Hubble parameter H=70km/s:
In: NaturalConvert[3*(70 km/s/Mpc)^2*MP^2, kg/m^3]
Out: 9.20429*10^-27 kg/m^3
Energy density fraction in photons:
In: NaturalConvert[Pi^2/15*(2.7 K)^4/(3 (70 km/s/Mpc)^2*MP^2)]
Out: 0.0000486043
Redshift to matter-radiation equality (roughly):
In: 1/%
Out: 20574.3
Temperature there:
In: NaturalConvert[%*2.7K]
Out: 4.78699 eV
Rough age of the universe there (Hubble time):
In: NaturalConvert[t /. Solve[Pi^2/15*%^4 == 3*1/t^2*MP^2, t][[2]], y]
Out: 4733.36 y
The last numbers should be understood as order-of-magnitude estimates.
The package was first introduced in arXiv:2110.12251.
The package has been tested in Mathematica 11 and 12.
NaturalUnitsSetup
. Third parameter of NaturalConvert
moved to option KeepUnit
. Added functions NaturalUnitsSetStyle
, NaturalUnitsAdd
, and NaturalUnitsList
.