Code: Select all
private void buttonCalcSR_Click(object sender, EventArgs e)
{
double t = 1.0;
double r = r_lower;
for (int i = 0; i < steps; i++)
{
t = t * GravitationalTimeDilation(M_planet, r, H);
r += H;
}
textBox1SRTimeDil.Text = t.ToString();
}
// As above, but we now calculate the time dilation for a small (local) room sitting
// at distance 'radius' from the centre of a gravitating mass (planet) of mass 'mass'.
double GravitationalTimeDilation(double mass, double radius, double h)
{
double g = G * mass / (radius * radius);
return AccelerationalTimeDilation(g, h);
}
// Special Relativity
// For an accelerating room/rocket of height 'h' this function returns the difference
// in the measured tick rate of a clock at the bottom of the room compared to a clock
// at the top of the room.
double AccelerationalTimeDilation(double g, double h)
{
return 1 - g * h / (c * c);
}