Automated Natural Unit Conversions in Mathematica

Introduction and Review

Natural units are a way to simplify repetitive fundamental constants in theoretical physics equations. In my research, I used three particular unit systems: geometric ($c=G=1$), natural ($c=\hbar=1$), and Planck units ($c=\hbar=G=1$). However, for me it is time consuming to convert to and from natural units. I decided that I would write an extension to Mathematica’s units package to remedy this.

A great summary of natural units goes in more detail in an excellent document here. Given a SI quantity $Q_{\text{SI}}$, the quantity in natural units is given by $Q_{\text{geometric}} = Q_{\text{SI}}/A$ for some factor $A$. For the rest of this post, I will use geometric units. Suppose that the quantity has SI units of the form

\[[Q_{\text{SI}}] = M^\alpha \times L^\beta \times T^\gamma \, ,\]

then, one can find $Q_{\text{geometric}}$ with the following factor

\[A = G^{-\alpha} c^{2\alpha-\gamma} \, .\]

So all we need to do to convert between the units is to find $A$.

Mathmatica Implementation

The first thing that we need to do is write a helper function that will return the $\alpha$, $\beta$, and $\gamma$ from our previous equation. All I need to do was write a wrapper class for the UnitDimensions[] fuction that Mathematica has.

GetUnitVal[qu_, unit_] := Module[{result, dims},
  dims = UnitDimensions[qu];
  If[Position[dims, unit] == {}, result = 0,
    result = dims[[Position[dims, unit][[1, 1]], 2]]];

Next, I wrote a function to calculate the constant $A$.

SItoGeometricDivideFactor[qu_] := Module[{\[Alpha], \[Beta], \[Gamma]},
  \[Alpha] = GetUnitVal[qu, "MassUnit"]; \[Beta] =
   GetUnitVal[qu, "LengthUnit"]; \[Gamma] = GetUnitVal[qu, "TimeUnit"];
   Quantity[1, "GravitationalConstant"]^-\[Alpha]*
   Quantity[1, "SpeedOfLight"]^(2 \[Alpha] - \[Gamma])

Finally, I used a function that will find $Q_{\text{geometric}}$ by dividing $Q_{\text{SI}}$ by $A$. Afterwards, it converts the result into meters to the $n$ power as is used in geometric units.

SItoGeometricUnits[qu_] := Module[{factor, geoqu},
  factor = SItoGeometricDivideFactor[qu]; geoqu = qu/factor;
   UnitConvert[geoqu, ("Meters")^GetUnitVal[geoqu, "LengthUnit"]]

The full version of these functions which includes geometric, natural, and Planck units is publicly available on my Github. Feel free to use it and I hope that it will save you time in your research!


Back to top ↑


Sigma Pi Sigma Presentation

less than 1 minute read

I gave a presentation to a conference organized at Sigma Pi Sigma at University of Virginia.

Gravity Group Presentation

less than 1 minute read

I gave an hour long presentation to the gravity research group at University of Virginia. It specializes on content from my upcoming paper.

College Science Scholar Presentation

less than 1 minute read

I had the pleasure of presenting my research to a group of first year students who are interested in scientific research. I gave an introduction to my resear...

Back to top ↑


LIGO SURF Final Report

less than 1 minute read

I spent the 2017 summer working with Marie Kasprazack, Arnaud Pele, and Adam Mullavey at LIGO Livingston through the Caltech SURF Program. I examined nonline...

LIGO SURF Final Presentation

less than 1 minute read

I presented the results of my research at LIGO from the summer of 2017 at Caltech for the SURF final presentation.

Back to top ↑



less than 1 minute read

I made this website on 10/21/2018 (though I have retroactively added some materials). I look forward to adding to it in the future!

Back to top ↑