Dimensional Analysis With Software

3 August 2019

• Keywords:
• physics
• Wolfram Alpha
• python

Shiri Avni

October 2019 Update: Following the drawbacks of Wolfram Alpha (listed below), I’ve developed a web wrapper for Pint’s dimensional analysis functions. Please see www.dimensionalanalysis.org.

Dimensional Analysis is a wonderfully neat & useful tool for coming up with physical formulas (for a quick overview, please see this. Historically, the calculations needed to do so were done manually. However, Wolfram Alpha, a computational answer engine, states that it has the capability to do so automatically online. Hence, the purpose of this post is to assess the pros and cons of the Wolfram Alpha software as a dimensional analysis tool, as of August 2019.

Use Case Example: Swinging Mass

In order to assess Wolfram Alpha, we’ll first need to decide on the use case examples to test. We’ll start out with the classic mass-on-a-string pendulum example, as depicted in the image below. Assuming a small swing angle, the swing frequency $\omega$ is known to equal $\sqrt{\frac{g}{l}}$.

A mass swinging periodically on a string
Photo from wikipedia.org.

Wolfram Alpha

Let’s pretend that we don’t know the formula for the swing frequency. Using Wolfram Alpha’s instructions, we input the involved terms, depicted below:

Mass on a string inputs

In this case, Wolfram Alpha works great, and it correctly deciphers the dimensions of the variables, and provides the dimensionless combination of them:

Parsed Input dimensions

Dimensionless combination of variables

Use Case Example: Star Vibrations

Let’s look at a more interesting example, one that you may not have seen before; it is from an MIT 2008 Classical Mechanics’ course, and is stated as follows:

Derive an expression for the vibration frequency of a star of mass $M'$ and radius $R$, if that vibration is caused by gravitational instabilities (i.e. is dependent on $G$, the gravitational constant).

I don’t know about you, but I don’t know much about stars. However, by noting that we want a derived dimension of frequency, i.e. $\frac{1}{T}$, and that $[M'] = M$, $[R] = L$, and $[G] = \frac{L^3}{M * T^2}$, we find that the only correct combination is $\sqrt{\frac{G * M'}{R^3}}$.

Wolfram Alpha

Inputting the variables of the star vibration problem as depicted in the photo below, completely confuses Wolfram Alpha. Try entering the input yourself, and you will see that Wolfram Alpha does not understand that we are looking for a dimensional analysis response. It seems that entering the phrase “gravitational constant” confuses the search engine, which only presents a list of facts about $G$.

Star Vibrations input

Wolfram Alpha's unuseful output

So, I then try to to explicitly state the dimensions of $G$, as seen below. This doesn’t help either, although Wolfram Alpha recognizes that it has received a physical quantity, so it is not a problem of badly parsed input.

Star Vibrations modified input

Wolfram Alpha's still unuseful output

Python & Conclusion

Alas, the conclusion of this post is that for any actual sophisticated dimensional analysis, Wolfram Alpha fails to deliver. In this case, one should resort to code, which is a bit less convenient, but does the job reliably and dependably. If you code in Python, I highly recommend Pint, which you can also use via the website www.dimensionalanalysis.org.