Steve3007 wrote: ↑
October 9th, 2018, 9:27 am
To try to make the above snippets of code clearer, and to try again to explain the process of iterating (numerically integrating) over a long series of small heights, within each of which the gravitational field can be regarded as uniform, here's a simple flowchart which schematically represents that code:
I can read the code. The GR functions are also missing. All you posted was the SR parts. The SR formula for the rocket needs no iteration. Just plug in the acceleration and height of the rocket to get the dilation factor, and then multiply that by the duration of the experiment to get the number of seconds difference after X many years.
As I've said, 'h' is a very small constant value. The smaller it is, the closer each section comes to having a uniform gravitational field within it, and the closer the approximation to the GR result. But each of these small sections is calculated at a different value of 'g' because they are each at a different value of 'r'. This is what happens in a process of numerical integration. That's what numerical integration means.
I know what numerical integration is. I used a similar method to simulate a stable inverted pendulum, a really weird effect of classical physics. You did it correctly, but you did it for varying gravity both times, never constant acceleration like you'd get in the rocket. That's why the numbers came out the same.
To do the rocket, you need to ignore r. There is no r in a rocket. There is just a fixed g, and the computations with GR and SR will still come out the same if you use fixed g instead of g computed as a function of r and m (nit: Mass is m, not M), but with a fixed g, there is no dilation in comparison with the clock at infinity, so that would not be computable, which illustrates that actual dilation is not a function of only g.
Correction of one of my comments: I had mistakenly put the escape velocity from the rocket at infinity, but actually its escape velocity is c. Anything slower than that shot from the front of the rocket, and the rocket will eventually catch up to it.