I would like to announce UnitfulGauss.jl — a small extension package for Unitful.jl that defines Gaussian electromagnetic units with the proper Gaussian physical dimensions.
Although Unitful.jl defines the Gaussian units, they have the physical dimensions corresponding to the SI unit system. If you would try to stick those into the equations expressed in the Gaussian unit system, you’d get nonsensical results.
Not to clash with the units defined by Unitful.jl, UnitfulGauss.jl uses the same symbols for the electromagnetic units but appends superscript g at the end. For example, the Coulomb unit of charge with gaussian physical dimension sqrt(𝐌*𝐋^3)/𝐓 is accessed as UnitfulGauss.Cᵍ.
The package exports the string macro @ug_str, which functions identically to the @u_str defined by Unitful.jl, but chooses the proper gaussian versions for the electromagnetic units under the hood
using UnitfulGauss
using UnitfulGauss
ug"C" === UnitfulGauss.Cᵍ
ug"Gauss" === UnitfulGauss.Gaussᵍ
ug"V/cm" === UnitfulGauss.Vᵍ/UnitfulGauss.Unitful.cm
In addition to that, the package also exports functions to_gauss and to_si, which translate the units and quantities to the gaussian unit system and back. This is useful if you want to translate the physical constants, for example.
using UnitfulGauss, PhysicalConstants
import PhysicalConstants.CODATA2022: ε_0
ε₀ᵍ = uconvert(UnitfulGauss.NoUnits, ε_0 |> float |> to_gauss)
4π*ε₀ᵍ ≈ 1.0
As expected, in the Gaussian system, the vacuum permeability is a dimensionless constant equal to 1/4π.
Finally, you can use the package without explicitly importing Unitful.jl. It reexports Unitful.jl, imports derived dimensions and even provides the true Gaussian versions of the physical constants defined in Unitful.jl.