Dimensional Analysis With Software

3 August 2019

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 is known to equal .

a simple pendulum

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:

a simple pendulum

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:

a simple pendulum

Parsed Input dimensions

a simple pendulum

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 and radius , if that vibration is caused by gravitational instabilities (i.e. is dependent on , 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. , and that , , and , we find that the only correct combination is .

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 .

a simple pendulum

Star Vibrations input

a simple pendulum

Wolfram Alpha's unuseful output

So, I then try to to explicitly state the dimensions of , 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.

a simple pendulum

Star Vibrations modified input

a simple pendulum

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.

Relevant Posts: