Tuesday, 17 November 2020

Constants and calculations

Babylonian equations
Carroll uses natural units in his book as do I on this web site. In natural units the speed of light, Planck's constant and Boltzmann's constants ##c=\hbar=h/2\pi=k=1##. In our equations these terms are left out. They need to be put in again to do real calculations and it's not always obvious how to do it. When Carroll does calculations he often uses centimeters and grams. I prefer to use SI units: meters and kilograms. 

It is also common to use geometric units which are units in which ##c=G=1## (so mass and energy have the same units as length and time). You cannot also have ##\hbar=1## in these units.

In natural units the Schwarzschild radius is ##R_S=2GM##. I suppose that in geometric units it is ##R_S=2M##. In SI units it is ##2GM/c^2##. The ##c^2## makes a big difference and is easy to forget!

The document contains a list in SI units of the values of universal constants and other handy constants like the mass of the sun. The table also gives the conversion factors from natural to SI units, which are derived from their dimensions. Two examples of their use are given at the end followed by a list of small and large prefixes (Terra, peta, pico etc) and their meanings. 

Tuesday, 10 November 2020

Plotting geodesics of Schwarzschild

I did some experiments with trying to plot solutions to the geodesics of Schwarzschild. They might give orbits of stars round the black hole Sagittarius A* at the centre of our galaxy. The geodesic equations become three simultaneous second order differential equations which give what I call the chugger equations below:
##t## is the coordinate time and ##r,\theta## are the usual plane polar coordinates. We are only considering curves in one plane. A prime indicates a derivative with respect to ##\lambda## which is the affine parameter from the geodesic equation and could be proper time. ##G## is old Newton's gravitational constant, ##M## is the mass of Sagittarius A* and ##c## is the speed of light.

We start with some initial values of ##t,t^\prime,r,r^\prime,\theta,\theta^\prime## and select some ##d\lambda## . Then we use those to get new values of  ##t,t^\prime,r,r^\prime,\theta,\theta^\prime## from the chugger equations again and again and again and put them in successive rows of a spreadsheet. The spreadsheet then uses the values of ##r,\theta## to plot the curve. One of the stars orbiting Sagittarius A* is S2 and we use that as our example. It completes an orbit about every 16 years. The first image was my first attempt. The shape is good (it follows the top part of the Newtonian ellipse) until it gets pretty close to the black hole. The second image shows a close up of the same curve near the black hole.

The dashed line is the ellipse that S2 would follow according to Newton's equations.



If I 'manually' decreased ##d\lambda## when near the black hole and then increased it again as S2 departed I could get the third image which shows the last leg of the approximation. To be able to do that conveniently I had to program the chugger equations in VBA. To do 1,000 iterations takes about three minutes.









Finally I did all the calculations in Excel adjusting ##d\lambda## as it went along and got the fourth image from a 20,000 row spreadsheet. The calculation time is about one second. It was the best so far but still not good enough. The furthest distance (apsis) of S2 from the black hole decreases by 4% - it should be the same. However the furthest distance did advance by 0.0012 radians. I calculated (with help from Carroll) that it should be 0.0035 radians.









For a bit of fun I also made an artist's impression of precession of the perihelion. It's simply done from the exact solution to Newton's equations which is an ellipse.

Further material including spreadsheets and VBA at

Tuesday, 3 November 2020

Solar orbit plotter

Here's how the plotter works
Newton's second law is$$
\vec{F}=m\vec{a}
$$Newton's law of gravity is$$
\vec{F}=\frac{GMm}{r^2}
$$They give you two differential equations of motion in polar coordinates$$
\frac{d^2r}{dt^2}-r\left(\frac{d\theta}{dt}\right)^2=-\frac{GM}{r^2}
$$$$
2\frac{dr}{dt}\frac{d\theta}{dt}+r\frac{d^2\theta}{dt^2}=0
$$Kepler's laws are
  1. The orbit of a planet is an ellipse with the Sun at one of the two foci.
  2. A line segment joining a planet and the Sun sweeps out equal areas during equal intervals of time.
  3. The square of a planet's orbital period is proportional to the cube of the length of the semi-major axis of its orbit.
The second differential equation quickly gives you Kepler's second law. It is more difficult to get$$
r=\frac{P}{1+e\cos{\left(\theta-\phi\right)}}
$$That is a circle when ##e=0##, an ellipse when ##\left|e\right|<1##, a parabola when ##\left|e\right|=1## and a hyperbola when ##\left|e\right|>1##. ##\phi## is the angle of the axis of symmetry of the curve. ##P## is a magic constant. The equation gives you Kepler's first law. 

Newton must have been very pleased when he did those. Part of the job was inventing calculus! 

The initial conditions determine ##P,e,\phi##. That requires more work if you only know the initial position and velocity.

Full details (except inventing calculus) in Commentary 5.4 Orbital toypdf. (9 pages)
The spreadsheets for plotting the curves are at 
Commentary 5.4 Orbital toy.xlsm (with animation macros)

Thursday, 22 October 2020

Maximally symmetric universes

In section 8.1 we meet maximally symmetric universes. That's universes where every point in spacetime is the same. I think the only ones are de Sitter, Minkowski and Anti de Sitter. We've done flat, boring Minkowski. De Sitter and Anti de Sitter are more interesting and we do conformal diagrams for both of them. At the end of the section Carroll does conformal anti de Sitter and casually draws some geodesics on it without saying how he plotted them. I was able to put my newly learnt skills to good use and show the same curves as he did😀. My version is on the left.

He also jumps back to section 3.1 and uses the equation there for the Riemann tensor. It is$$
R_{\rho\sigma\mu\nu}=\kappa\left(g_{\rho\mu}g_{\sigma\nu}-g_{\rho\nu}g_{\sigma\mu}\right)
$$where ##\kappa## is a constant. That equation easily becomes$$
R_{\ \ \ \sigma\mu\nu}^\rho=\kappa\left(\delta_\mu^\rho g_{\sigma\nu}-\delta_\nu^\rho g_{\sigma\mu}\right)
$$so it looks like there's a really way to calculate the fiendish Riemann tensor for these special cases. Unfortunately $$
\kappa=\frac{R}{n\left(n-1\right)}
$$where ##n## is the number of dimensions and ##R## is the curvature scalar (aka Ricci scalar) which is constant in a maximally symmetric universe. Nevertheless to calculate it you have to calculate the Riemann tensor first! B*gger.

I still wanted to check that it was all true. We already did it for a the surface of a unit sphere, S², and have found it was constant at 2 and its Riemann tensor does satisfy the formula above. So S² is maximally symmetric. All points on the surface of a sphere are equal. The metric for conformal anti de Sitter is$$
{ds}^2=\frac{\alpha^2}{\cos^2{\chi}}\left(-{dt^\prime}^2+{d\chi}^2+\sin^2{\chi}{d\Omega_2}^2\right)
$$where ##\alpha## is some constant. So its Riemann tensor is trickier!

As I had already calculated the Christoffel symbols for that to make the diagram above, I calculated its Riemann tensor and then its curvature scalar which is ##-12\alpha^{-2}##. So it is constant and satisfies the formula as I checked with a cunning spreadsheet.

Calculating that Riemann tensor, which is a relatively easy one, took 9 hours 45 minutes over three days and six sittings. I got faster as I went along, notwithstanding long lunches preceded by a refreshing dry martini.

Read all about it at
and

Friday, 9 October 2020

Plotting geodesics numerically

Geodesic equations are sets of second order differential equations and are usually somewhere between hard and impossible to solve analytically. The following are the geodesic equations for the surface of a sphere (S²):
$$\frac{d^2\theta}{d\lambda^2}-\sin{\theta}\cos{\theta}\left(\frac{d\phi}{d\lambda}\right)^2=0$$
$$\frac{d^2\phi}{d\lambda^2}+2\cot{\theta}\frac{d\phi}{d\lambda}\frac{d\theta}{d\lambda}=0$$They are about the simplest you can get and I still don't know if it's possible to solve them. When you have the solution you will be able to plot the geodesic curves as on the graph above.

This road block is very annoying and I have finally busted through it. It only took a couple of days! I started with some very simple examples to test that what I was doing was correct and tested the theory on said S² which I had explored in March 2019. It all works and the general procedure for constructing geodesics is quite straightforward really! What a nice surprise.😀

Read all about it here Plotting a differential equation.pdf (8 pages with lots of picture). It's a short instruction manual on how to do it yourself.

Wednesday, 30 September 2020

Very obscure bug in Google Blogger

I use Google Blogger for this blog. I also use MathJax for displaying equations which are in a code called Latex. Google recently introduced major changes to Blogger and it screwed up the equation display. I prepare text for a post in MS-Word so we might have something like this (but replace all £ signs by $ signs)
££\chi_\nu\nabla_\mu\chi_\sigma+\chi_\sigma\nabla_\nu\chi_\mu+\chi_\mu\nabla_\sigma\chi_\nu=0
££
and it should come out like this$$
\chi_\nu\nabla_\mu\chi_\sigma+\chi_\sigma\nabla_\nu\chi_\mu+\chi_\mu\nabla_\sigma\chi_\nu=0
$$but sadly it now comes out like this
$$
\chi_\nu\nabla_\mu\chi_\sigma+\chi_\sigma\nabla_\nu\chi_\mu+\chi_\mu\nabla_\sigma\chi_\nu=0
$$
which is not what is wanted!

To move the Latex code from MS-Word was simply a matter of copying it and pasting it as plane text (Ctrl+Shift+V).

In the old version of Blogger linefeeds produced HTML <br/>, in the new version they produce </div><div>, which screws up Mathjax. The old version and the new version of the HTML are shown below (once again, replace all £ signs by $ signs)

££ <br/>\chi_\nu\nabla_\mu\chi_\sigma+\chi_\sigma\nabla_\nu\chi_\mu+\chi_\mu\nabla_\sigma\chi_\nu=0<br/>££

££ 
</div><div>\chi_\nu\nabla_\mu\chi_\sigma+\chi_\sigma\nabla_\nu\chi_\mu+\chi_\mu\nabla_\sigma\chi_\nu=0 </div><div>££

Solution

  1. To begin with I just edited the latex removing linefeeds and reinstating with shift-enter. That replaces  </div><div> by <br/>. You also have to make sure that the text style is Normal not Paragraph. The editor sometimes seems to start in the latter mode.
  2. Then I discovered Search replace in HTML editing view. So now I just replace all </div><div> by <br/>.
It's still rather tedious. I wish the lovely people at Google would fix it.

Thursday, 17 September 2020

Curvature in two dimensions

Here we calculate formulas for curvature in two dimensions. Specifically we give coordinates, metrics, Christoffel symbols, Riemann tensors (only twice) and scalar curvature (or Ricci scalar) for ellipsoids, elliptic paraboloids and hyperbolic paraboloids.

Images from Wikipedia: Ellipsoid , Paraboloid

We also find a general formula for the scalar curvature in two dimensions which only requires one component of the Riemann tensor. On the way we find the formulas to calculate all the other non zero Riemann components from the one. With coordinates ##\left(\theta,\phi\right)## which are naturally used for the ellipsoid, the formula for the scalar curvature is $$
R=\frac{2}{g_{\phi\phi}}\left(\partial_\theta\Gamma_{\phi\phi}^\theta-\partial_\phi\Gamma_{\theta\phi}^\theta+\Gamma_{\theta\theta}^\theta\Gamma_{\phi\phi}^\theta+\Gamma_{\theta\phi}^\theta\Gamma_{\phi\phi}^\phi-\Gamma_{\phi\theta}^\theta\Gamma_{\theta\phi}^\theta-\Gamma_{\phi\phi}^\theta\Gamma_{\theta\phi}^\phi\right)
$$This is very similar to the formula given at the very end of the Wikipedia article on Gaussian curvature ##K## which is$$
K=-\frac{1}{E}\left(\frac{\partial}{\partial u}\Gamma_{12}^2-\frac{\partial}{\partial v}\Gamma_{11}^2+\Gamma_{12}^1\Gamma_{11}^2-\Gamma_{11}^1\Gamma_{12}^2+\Gamma_{12}^2\Gamma_{12}^2-\Gamma_{11}^2\Gamma_{22}^2\right)
$$The article also reveals that the scalar curvature is twice the Gaussian curvature. The Wikipedia formula might be better written with all the one indices replaced by ##u## and all the 2 indices replaced by ##v##. Then reverting to ##\theta,\phi## as indices, the thing in brackets in the first formula is ##R_{\ \ \ \phi\theta\phi}^\theta## and in the second is ##R_{\ \ \ \theta\theta\phi}^\phi##. The relationship mentioned above between Riemann components is
\begin{align}
R_{\ \ \ \theta\theta\phi}^\theta&=\frac{g_{\theta\phi}}{g_{\phi\phi}}R_{\ \ \ \phi\theta\phi}^\theta&\phantom {10000}\nonumber\\
R_{\ \ \ \theta\phi\theta}^\theta&=-\frac{g_{\theta\phi}}{g_{\phi\phi}}R_{\ \ \ \phi\theta\phi}^\theta&\phantom {10000}\nonumber\\
R_{\ \ \ \phi\theta\phi}^\theta&=\partial_\theta\Gamma_{\phi\phi}^\theta-\partial_\phi\Gamma_{\theta\phi}^\theta+\Gamma_{\theta\theta}^\theta\Gamma_{\phi\phi}^\theta+\Gamma_{\theta\phi}^\theta\Gamma_{\phi\phi}^\phi-\Gamma_{\phi\theta}^\theta\Gamma_{\theta\phi}^\theta-\Gamma_{\phi\phi}^\theta\Gamma_{\theta\phi}^\phi&\phantom {10000}\nonumber\\
R_{\ \ \ \phi\phi\theta}^\theta&=-R_{\ \ \ \phi\theta\phi}^\theta&\phantom {10000}\nonumber\\
R_{\ \ \ \theta\theta\phi}^\phi&=-\frac{g_{\theta\theta}}{g_{\phi\phi}}R_{\ \ \ \phi\theta\phi}^\theta&\phantom {10000}\nonumber\\
R_{\ \ \ \theta\phi\theta}^\phi&=\frac{g_{\theta\theta}}{g_{\phi\phi}}R_{\ \ \ \phi\theta\phi}^\theta&\phantom {10000}\nonumber\\
R_{\ \ \ \phi\theta\phi}^\phi&=-\frac{g_{\theta\phi}}{g_{\phi\phi}}R_{\ \ \ \phi\theta\phi}^\theta&\phantom {10000}\nonumber\\
R_{\ \ \ \phi\phi\theta}^\phi&=\frac{g_{\theta\phi}}{g_{\phi\phi}}R_{\ \ \ \phi\theta\phi}^\theta&\phantom {10000}\nonumber
\end{align}So now it is easy to work out that the mysterious ##E## in the Wikipedia formula should be ##g_{\theta\theta}## which is the same as ##g_{11}##. 

For the record the scalar curvatures for the ellipsoids, elliptic paraboloids and hyperbolic paraboloids are respectively$$
R_{El}=\frac{2b^2}{\left(a^2\cos^2{\theta}+b^2\sin^2{\theta}\right)^2}
$$$$
R_{Ep}=\frac{2a^2}{\left(1+a^2r^2\right)^2}
$$$$
R_{Hp}=\frac{-8}{\left|g\right|^2a^2b^2}
$$These are a bit vague until you know what the coordinate systems are but you can see what the sign of the curvature is which is what I was interested in.

Why did I do all this?

This was quite a project. It was sparked off by the following:
On Physics Forums Ibix said:
I don't know where you [JoeyJoystick] are getting numbers for the mass of the universe from - our current understanding is that it's infinite in size and mass.
I said:
Universe infinite in size and mass? That's extraordinary. Where can I read more about it, please?
Ibix said:
I would think Carroll covers it - chapter 8 of his lecture notes certainly does. The flat and negative curvature FLRW metrics are infinite in extent and have finite density matter everywhere. Modern cosmological models are a bit more complicated, but retain those features.

Chapter 8 in the book is on Cosmology and about 50 pages long. Part 8 of the lecture notes is on Cosmology and contain 15 pages. I think those are the places to look, but after a quick look I did not find anything specifically about the size of the Universe.

If the universe has flat or negative curvature locally and then we presume that applies everywhere, that implies it is infinite in extent. Presumably shortly after the big bang the universe was finite in extent, so at some time it must have changed from finite to infinite! Maybe that's inflation?

So I decided to test the flatness idea in two dimensions....
Summary in Commentary 8 Curvatures 2D.pdf (6 pages), mostly pictures.
Full details in
Commentary 8 Curvatures 2D calculations.docx
or Commentary 8 Curvatures 2D calculations.pdf (24 pages)