# An amateur’s foray into physics

By | 25. May 2014

It has long bothered me that I know so little about physics and the maths that goes along with it. There are some great popular-science books on physics, but I wanted to dig deeper. So I turned myself into a “self-taught undergraduate” last year (on a tiny, after-work time budget).

Like any university course in physics, I started with the sub-field of Classical Mechanics , which is concerned with the “set of physical laws describing the motion of bodies under the action of a system of forces” (Wikipedia).

So I bought some books (primarily the notorious Landau/Lifshitz) and began. Some of the exercises, even simple-looking ones, lead into remarkably big calculations. Even though I usually enjoy calculating, it felt like a chore sometimes, and I looked for a remedy. Luckily, we have computer algebra systems these days, and after some thought and trial I ended up using the Mathematica software.

I soon found the computer-aided approach addictive. Not only does the software help with big, boring, error-prone calculations. The need to formulate solutions in a machine-tractable way also makes me think more deeply and conceptually about the maths. Plus, the software leads me to discover useful maths I don’t yet know, like any programming language leads to discovering new useful libraries. Finally, the software makes it easy to play around with the parameters of an exercise and visualize the solutions.

This post shows an example of an exercise aced with computer help. It is about a mass that can move around on some surface, in the presence of gravity, with no friction. Like a piece of soap in a bath tub. Here is a concrete case: A mass tied to a surface, in the presence of gravity, with no friction

Classical mechanics has a neat way of describing a whole system of moving parts by a mathematical term called Lagrangian. It’s beyond the scope of this post to explain the theory behind Lagrangians, but they are really cool. The Lagrangian for this system is:
$$\frac{m}{2}(\dot{x}^2 +\dot{y}^2 +\dot{z}^2) - m g z + \lambda(z - h(x,y))$$

The symbol $m$ stands for the particle’s mass, $g$ is the gravity constant, $x$, $y$ and $z$ are the particle’s coordinates, and $\dot{x}$, $\dot{y}$ and $\dot{z}$ the corresponding speeds. The function $h$ describes the shape of the surface. It can be any sufficiently well-behaved function. In our example, I used a certain polynomial to obtain an interesting hilly terrain. The most interesting part of our Lagrangian is probably the constraint, $\lambda$, which corresponds, up to constants, to the force that keeps the mass on the surface.

The Lagrangian is a succinct description of the system, but it does not lend itself well to calculate the actual motion. We need to calculate the laws of motion from a Lagrangian. The laws of motion are also called Euler-Lagrange Equations, or just Euler Equations or Lagrange Equations. They form a system of ordinary differential equations (ODEs). There is an easy method, which I won’t introduce here, to obtain the laws of motion from the Lagrangian. Mathematica even has an optional package, called “VariationalMethods”, which contains a command “EulerEquations”, which does exactly this: get the laws of motions from a Lagrangian. The result, in our case, turns out to be this system of ODEs:

\begin{aligned} m \ddot{x} &= -\lambda \frac{\partial h}{\partial x} \\ \\ m \ddot{y} &= -\lambda\frac{\partial h}{\partial y} \\ \\ m \ddot{z} &= -\lambda - m g \\ \\ 0 &= z - h \end{aligned}

Things are beginning to look quite Newtonian here: the first three equations have on the left side terms describing “mass times acceleration”. On the right side, they have terms that at close inspection turn out to be forces. The last equation results from the constraint and just states that the vertical $z$ coordinate results from applying the surface description $h$ to the horizontal coordinates $x$ and $y$.

We are now a step closer to calculating the actual motion, but we must still obtain the actual function that describes the movement. That function, which maps time to coordinates, is a solution of of the above system of ODEs. I wrote “a” solution and not “the” solution, because there is one solution for each initial condition, by which we mean the particle’s coordinates and speeds at the start of its journey. Of course, we must also fill in the mass $m$, the gravity constant $g$, and the surface shape $h$ to determine the system fully.

In lucky circumstances, the “motion function” corresponding to a system of ODEs can be given as a symbolic formula. But often, the solution can only be approximated numerically. In our case, we can find symbolic solutions for certain very simple surfaces $h$, e.g. non-curved surfaces, but not for interesting ones like the one in the animation above. In our case, the surface is actually
\begin{aligned}h(x,y) &= (x-3)(x-2)(x-1) \\ & \quad (x+1)(x+2)(x+3) \\ & \quad (y-3)(y-2)(y-1) \\ & \quad (y+1)(y+2)(y+3) \end{aligned} Neither I nor Mathematica can find a symbolic solution for this $h$. (It’s most likely impossible, but I don’t know how to prove that.) Even when we ask only for a numerical solution, Mathematica cannot give one straight away, because the system of ODEs contains certain snags. For Mathematica to succeed, I had to eliminate $z$ and $\lambda$ first, and then solve for $\ddot{x}$ and $\ddot{y}$. I’ll spare you the details, what counts is that finally, Mathematica is able to give a numerical solution.

Before I created the animation above, I played around with the initial conditions and let Mathematica visualize the trajectory of the particle:

After I found a nice trajectory to show off, I created the animation. The Mathematica programming language has convenient primitives for creating animations. The animation turned out to be very slow, because of the time the software needs to calculate the numerical solution of the ODE system. But that didn’t matter for this post, because I had to export the animation as a animated GIF anyway. Mathematica has a nice trick for doing this: there a command, called Table, which allows to create a sequence of images instead of an animation, like a thumb cinema. That image sequence can than be exported as a GIF.

In summary, we have seen: Classical Mechanics provides a great way to model systems by so-called Lagrangians. These lead automatically to the laws of motion. These form a system of ODEs that can be solved either by hand or with software. The software can also help explore and visualise the system.

## 5 thoughts on “An amateur’s foray into physics”

1. William Bliss

Very nice animation. It reminded me of a problem, rude of me to present to you this way, but who knows you might find it rewarding.

There is a valuable concept missing from many people especially climate deniers. This concept concerns how nonlinear systems often have multiple semi-stable zones where local restoring forces act until the system gets bumped over the hill into a different zone.

Our atmosphere is presumed to be such a system, though with many, many dimensions. If, though, we knew the equations which described the atmosphere and plotted two of them, say average global temperature and average global cloud cover, we might get a graph similar to yours.

The educational trick would be to show how changes in atmospheric gas content can change the heights of the hills surrounding the local stable zone that our current global climate point is bound to. As these hills change shape it becomes possible for our global climate to randomly climb too far up one of these, now lower, valleys and fall into a neighboring stable zone. Of course, the danger of this is that one of these stable zones might be the “snowball earth” zone which Earth seems to have fallen into several times in the past.

A few modifications to your animation program (labels, colors, changing hill heights, etc.) could be a wonderful tool to demonstrating this rather abstract concern that atmospheric scientists have.

Just a thought from a fellow physicist.
Thanks

1. Carsten Führmann Post author

Wow, a comment on the blog as opposed to social media – that doesn’t happen often! The whole climate issue has been on my mind for quite a while. I know the models are very complex and still maturing. While I think it would be great to use convincing, educational simulations, they would have to be created or at least supervised by an expert in the field, to avoid becoming an easy target.

However, I learned something very depressing recently that makes me reconsider the whole strategy for convincing people about the reality of global warming: recent research into people’s (in)ability to change their beliefs, by Brendan Nyhan, a professor of political science at Dartmouth. Here is an article about it: http://www.newyorker.com/online/blogs/mariakonnikova/2014/05/why-do-people-persist-in-believing-things-that-just-arent-true.html
Basically, the finding is that people change their beliefs according to evidence if and only if the belief is not tied up with their sense of identity. In some cases, e.g. the structure of the solar system, beliefs are not tied up with people’S identities. In other cases, e.g. global warming, they are. (How could it come to this?) It probably means that the way to communicate the scientific findings is not a matter of well-presented simulation, but one of psychology 🙁

2. Richard McKinley

Hi Carsten! I came looking for your publications, and found this instead! (I’m essentially retired,or at least on hiatus, from logic, (I now work in machine-learning for medical applications) but a review request came in that I felt needed specialist attention)

I fully sympathise with your frustrations regarding physics: actually for me it’s a little more shameful, since I actually took several low-level theoretical physics courses during my undergrad degree. Last year I took on statistical mechanics, which I think would appeal to your programming-driven approach to physics: I guess it’s too late to pick up the course now, but I highly recommend “auditing” a few of the lectures and homeworks.

1. Richard McKinley

Oh, arse. Sorry about the non-terminated html tag…

2. Carsten Führmann Post author

Hi Richard,

After a long pause, I’m doing some admin work on my blog, and I’ve just stumbled upon your comments. That’s strange, because I’m supposed to receive email notifications when someone adds a comment, and that used to work.

Anyway, it’s very interesting to hear that you moved from logic into a different field. It’s probably not a bad idea to get in a different mode and study something appliable. I don’t do much science these days, but I’ve never dropped the ball completely. I’m learning physics out of curiosity, and to to fill embarrasing white spots on my map of science. I’ve just finished an online quantum mechanics course. I learned a lot; the main problem for me wasn’t the maths, but to envisage the experiments whose results the maths is supposed to predict… In classical mechanics, it’s easy: I can imaging a bouncing ball; but I don’t seem to have any items at home that show me quanta 😉

Best,
Carsten