The Power of Notation—The Einstein Field Equations

Programmers know how important notation can be. Much of the progress in programming languages over the decades has been in finding more expressive ways to write algorithms which, when coded in earlier languages, are cumbersome, difficult to understand, and prone to error.

(This post is based upon, and uses illustrations from, a Profound Physics article, “Einstein Field Equations Fully Written Out: What Do They Look Like Expanded?”, which I highly recommend, including its links that explain the underlying physics. I have adapted the presentation to focus upon the power of notation to express concepts, particularly as it applies to computer programming language design.)

This is true in mathematics and science as well. The use of calculus in Britain was impeded for years by its use, out of patriotic pride, of Newton’s clumsy “fluxion” notation while mathematicians and physicists on the Continent adopted Leibniz’ notation, which is universally used today.

An excellent example of the power of notation can be seen in the Einstein field equations, which are the heart of general relativity, the geometric theory of gravitation. Written in modern tensor notation, the entire theory is expressed as:

G_{\mu\nu} \Lambda g_{\mu\nu}=\frac{8\pi G}{c^4}T_{\mu\nu}

But those tensor terms, such as G_{\mu\nu}, mean this simple equation actually expresses 16 different equations in the subscripts \mu and \nu which, as this is a four dimensional theory of space and time, take on values from 0 to 3. (Due to symmetry considerations, the 16 equations can actually be collapsed to “only” 10, but we can ignore this when considering notation.)

If the left side of the equation is expanded out in terms of the metric tensor g_{\mu\nu} we get the equivalent equation.

But the above equation uses a shorthand notation called the “Einstein summation convention” in which an index variable appearing twice in a term implies summation over all of the values of the index. So, in this case, the \alpha, \beta, \rho, and \lambda superscripts and subscripts in the left hand side terms express summations which, if written out explicitly, look like:

But, of course, the \sum notation for summation is also a shorthand, albeit with a longer pedigree than Einstein’s (it was invented by Leonhard Euler in the 18th century), which means that if we completely wrote out just the first term in the equation above, we’d have:

Expanding the entire left hand side is left as an exercise to you, the gentle reader.

Now, the point is, for programmers, that all of this tedious work expanding compact and expressive notation into what is really going on at the bottom level (which you have to if you’re going to, you know, actually calculate with these equations) is something at which computers are very good and humans are…not that great. Good notation allows translating thought into computation with minimum risk of error and makes a program readable in terms of the problem it’s solving, not how the computer goes about getting the answer out.

7 Likes

But only in the hands of a skilled programmer. The rest of us duffers are still sucking the end of our pens, wondering whether to use a FOR loop or a DO loop.

This is a great example of how mathematics really is a very concise language – a language which is at least as difficult to learn as Greek, and maybe even Chinese.

1 Like

But maybe the fact that you need to write a loop at all is a shortcoming of the programming language (including its libraries). For example, in scientific programming many loops back in the day (and even now) are doing things like computing dot products of vectors, multiplying matrices, transforming a vector with a matrix, etc. If the programming language provided these as fundamental operations, not only would the programmer not need to write them out as loops (which are very easy to get wrong), but would be writing code that directly expresses the mathematics and algorithm, not getting down into the weeds of how the subscripts are twiddled. Further, when the compiler knows what you’re doing (say, adding two vectors to get a third) it can take advantage of the machine’s built in speed-ups for such operations (of which there are many in Intel processors and modern graphics processor units) and not try to figure out how to convert the user’s loop back into the operations it’s really trying to do.

This applies to non-mathematical programming as well. Why should you need to write a loop to do simple things like find the largest, smallest, sum, or mean value of a table of numbers, or to sort a table into order? The advantage of expressing the problem at a higher level is that the compiler and library can provide the best practice implementation of an algorithm on the target hardware to accomplish the task, which may be much better than what a programmer may throw together on the spot.

For the last couple of years I’ve been writing 3D model programs in a language which supports vectors and rotations (quaternions) as primitive objects with all of the usual operations written as expressions in the language (v2 = v1 * r transforms vector v1 into v2 with the rotation r). When you read such code, you can see exactly what is going on, as opposed to a loop that did the same thing.

This is exactly how mathematical notation and conventions work: compressing the low-level operations into higher level concepts so you and work with them (”adding vectors”) without getting into the details of how it’s done.

3 Likes

I think I get the gist of this. Thank you for posting it. The power of notation and encoding it accurately come thorough. I have been completely ignorant of it. At the same time, as is often the case with real modern science, I am incapable of understanding the details at all. At first blush, one might say it’s not too late to learn. However, at 77+, my ability to understand abstraction is decaying, likely exponentially (if, indeed it can be measured), making me afraid to even try.

Simply having the above notation expressions enter my visual field causes sometthing akin to a mental freeze, akin to a blackout or a whiteout (these, alas, may even be dangerous or suspect words to use nowadays - nothing abstract about the possibilityof rocks crashing through the house windows for ‘wrong-speak’). I was subject to these mental flashes beginning in college and the threshhold for ignition has lowered considerably with age. I used to call them ‘mathouts’. Since I can still see the other words on the page, maybe they are more of a scotoma (mathoma?, symbolic illogic?, cognitive dropsy?). I fear I am no longer capable of understanding the basic infrastructure of the information explosion which characterizes our times (I grew up on Gilligan’s Island - see adjacent post - and Dobie Gillis. Then, the Sun took a back seat to Thalia Menninger as the center of the solar system, if not the universe). Fewer abstractions back then; life seemed simpler when the curves I saw didn’t necessarily relate to spacetime.

2 Likes

We could really use a program that would replace all 1/c d/dt … with 1/c d/dt(S…)
For Guv expanded out as in your article for every term
It gets even more complex there will also be spatial gradient of S
For generating gravity inside matter in artificial materials

I am dying to know what language this is.

2 Likes

It is Linden Scripting Language (LSL) for the Second Life virtual world. You can see a number of programs I’ve written in this language among my GitHub repositories—look for the ones with a language tag of “LSL”. A particularly good example for the vector and rotation capabilities is the Orientation Cube, which is demonstrated in the following video.

This is a model I built to help developers learn how rotations, translations, and co-ordinate transformations work in LSL.

1 Like

Ah, thank you! I’d seen some of your examples before. Cool!!

The power of notation really clicked for me when considered in light of the idea that the number of bugs in a program scales roughly linearly with the number of lines of code. APL suddenly becomes very compelling!

1 Like

I first learned to use quarternions about twenty years ago with ABB’s “RAPID” programming language for their 6-axis robots. I thought I’d died and gone to heaven.

2 Likes