[ANN] NaturallyUnitful.jl Natural Units for Physicists

NaturallyUnitful.jl is a little package I made for conveniently switching to so called ‘natural units’ where one sets ħ = c = ϵ₀ = kb = 1. It’s built on top of the wonderful Unitful.jl and in fact re-exports it so that using NaturallyUnitful is equivalent to using Unitful plus some extra function definitions for natural units. I’ve found it to be quite handy while using the REPL as a calculator so I figured I should put it out there for others to use if they desire.


By the way, in case anyone is curious, I couldn’t simultaneously let G = 1 since that introduces an ambiguity. In particular, c = G = 1 lets one convert energy to cm, but c = hbar = 1 lets one convert energy to cm^-1. By contrast ħ = c = ϵ₀ = kb = 1 is unamigious in that there are a unique set of powers of ħ, c, ϵ₀ and kb that one must multiply by to convert to and from natural and unnatural units.

Perhaps if there’s interest though there could be a separate package for the ‘geometrized units’ of general relativity where c = G = 1.


I constantly rant and berate people about how bad the units they are using are and why hasn’t the whole world just switched to natural units already and SI is already bad enough so imperial units are an unholy abomination. People probably find this really annoying. Now I can also tell them that they should use this package and they will be even more annoyed. Thanks!

Is there any way we could get it to use GeV? (It might even be nice to make that a default, though of course that’s showing a strong HEP bias.)


Yeah, it’s so simple. Instead of “I am 25 years old” it’s just “I am 1.1977904660817973e24 eV^-1 old”. :stuck_out_tongue:

Right, I had actually meant to provide some sort of interface to choose your base unit. Originally I thought it wouldn’t be a huge deal since you can jut uconvert to GeV or whatever but it’s better to do it inside the natural call so that you don’t lose accuracy on floats due to rounding. It’d be an easy change, what would you think of a syntax like:

julia> natural(1u"m")
5.067730759202785e6 eV^-1

julia> natural(1u"m", base=u"GeV")
5.067730759202785e15 GeV^-1

so that way you can just do a definition like

HEPnatrual(x) = natural(x, base=u"GeV")



It’s simpler than it sounds, 1~\mbox{s} \approx 1.5~\mbox{feV}^{-1}. Nobody says you have to use a unit that’s dozens of orders of magnitude off from your use case. Of course, it would be better to use the electron mass or something like that instead of an arbitrary unit like eV (again, nobody says you need to always be dozens of orders of magnitude off), but one thing at a time I guess (and besides 1 GeV isn’t too far from the proton mass, so I guess it’s not that bad).


1 Like

Okay so I’ve implemented this sort of functionality and tagged a new release. Just waiting for the new tag to be merged to the registry. If you’re in a hurry, just do add NaturallyUnitful#master.

1 Like
julia> using NaturallyUnitful

julia> Unitful.register(@__MODULE__);

julia> @unit fmₑ "fmₑ" FemtoElectronMass 0.511u"neV" true

julia> @unit yr "yr" Year 365u"d" false

julia> natural(25u"yr", base=u"ffmₑ")
0.6120709281677985 ffmₑ^-1

Okay, so I’m 0.612 inverse femto-femto-electron-masses old. I can get used to this. :slight_smile:

One year is 0.02448 inverse femto-femto-electron-masses so that’s not too hard to remember.


The idea of natural units is that units should be related to each other in reasonable ways. There’s nothing stopping you from designating “human scale” natural units, perhaps a cubit for length \sim 1~\mbox{m} and a tic for time \sim 1~\mbox{s}. The idea of natural units is that you could be assured that each of these is 10^{n}m_{e}^{-1} for some n. You can still perform mundane tasks like cutting wood using units of cubits or centicubits without thinking much of it, and it would always be easy to convert to “bare” natural units.

Choosing a system of units in which all the units are related to each other and to one natural constant which can be measured with extremely high precision does not have to inconvenience you. After the redefinition of the kilogram, this is more or less how SI works, the problem with SI is just that all the conversion coefficients are bonkers and it has way too many of them (including spurious units like kelvins and coulombs which don’t have much reason to exist).

By the way, when I was a TA, I would always try to get them to introduce different systems of units as early as possible, especially for electromagnetism courses. They’d never do this. So, the students never, ever checked the units of their results, because it was a big pain and nobody could ever remember the units of the constants. You’d ask them to something like the capacitance of a idealized plate capacitor in terms of geometric quantities, and maybe they’d misremember and respond with something like \epsilon_{0}A/d^{2}. They should immediately be able to see that the dimensions of that are wrong: capacitance clearly has dimensions -1 (C=q/V), not 0. Instead people constantly give answers that make no sense, because it’s too laborious for them to check the units.

So, natural units are not just for helping people doing high energy physics, they really are useful the moment you start trying to understand the natural world.

Ok, rant over :laughing:


In string theory, it’s also popular to work with so-called supernatural units, in which additionally h = hbar = 2pi i = 1. How would you feel about adding support for that scheme?

Are you seriously asking to add this identity? :sweat_smile:

It really helps proving theorems!