Mathview has a series of very interesting videos on YouTube about Differential Geometry and related topics. In one of these videos he attacks the problem of finding the metric tensor for the 3-sphere using as coordinates a set of 3 orthogonal angles and a radius. Here's the first part of the video:
What's the Metric Tensor of the 3-Sphere?
This is a good exercise for those learning the subject as it gives us the opportunity to apply the theory to a concrete example. Of course, working with S^3 is not the best example of concrete mathematics because it requires dealing with 4 dimensions, but you know what I mean. Besides, the 3-sphere received a lot of attention lately due to the proof of the Poincaré Conjecture by Perelman.
The exercise is not intrinsically difficult, but it involves a lot of calculations in the form or partial derivatives and trigonometric simplifications. It is very easy to eat a minus sign here or use a sin(x) where cos(x) was meant and wreck the whole thing. Since this is basically a mechanical process, Mathview calls it "turning the crank".
Since I'm learning to use Maxima, which has powerful symbolic manipulation features, I thought it might be a good idea to exercise it trying to verify Mathview's result for the S^3 metric tensor. In other words, I'd like to "turn the crank" the digital way. I must say that it took me many hours to put all the pieces together, but in the end it was well worth the effort. Not only did I verify that Mathview's result was correct (not that I doubted it :-) but I also learned a few interesting things about Maxima.
I wanted to Read The Fine Manual entirely but that seemed like a bad idea since it's very large (900+ pages) and has lots of specialized packages that are not of my concern for now. Therefore I just skimmed over the main topics and tried to extract what I needed for this job. I immediately saw that it has a tensor package which knows about the metric tensor, Christofell symbols, etc. However, that was too complicated for a first encounter with Maxima, so I just used its generic features. As I learn more about Maxima I may revisit this exercise and try to do it with the itensor/ctensor packages.
We start by defining how the Cartesian coordinates relate to the polar coordinates. These relations were derived by Mathview at the beginning of his video. Moving from 3D to 4D with an orthogonal angle was a nice trick! Then we define an array 'X' with these definitions.
Two things to note here. First, Maxima knows about Greek letters like "theta" and wxMaxima (the GUI) renders them nicely as one would see in a well typeset book. Second, the square brackets used to denote the indices are transformed into subscripts, also as we would expect. We must use this notation here as it will allow us to refer to these variables generically via their indices.
As a first test, let's find the derivative of X with respect to theta1:
Now we define the metric tensor. It's the dot product of the partial derivatives of the coordinates. In this case we're only interested in the angles, so we leave out the radius, which we take to be constant (say, 1).
Note that this is not yet the tensor. It's just a "matrix function". For instance, if we want to know a particular element, it can be evaluated:
Here we learned that Maxima does not perform all the simplifications when presenting its results. Depending on what kind of calculations you're doing, there are different simplification functions and strategies. In our case, "trigsimp" did the trick and transformed that long trigonometric expression into r^2.
Finally, in order to create the g matrix we use "genmatrix", which will apply the function to all the indices. The result was not in a simplified form, but applying trigsimp after that reduced the matrix to the form that Mathview derived by hand!
I hope this has been a small but interesting introduction to Maxima. In future posts I will continue exploring it.
No comments:
Post a Comment