Photon redshift for Schwarzschild black holes

https://en.wikipedia.org/wiki/Gravitational_redshift





       2 G M
 Rs = ------- 
        c^2

                R1 (R2 - Rs)
 f1 = f2 sqrt[ -------------- ]
                R2 (R1 - Rs)

       f2 - f1
  z = ---------
         f1

 Where Rs = Schwarzschild radius 
        M = black hole mass
        G = gravitational constant
        c = speed of light in vacuum
       f1 = observed frequency
       R1 = observer distance from singularity (ie. center of mass of the black hole), > Rs
       f2 = emitted frequency 
       R2 = emitter distance from singularity, > Rs
        z = redshift
      [-z = blueshift]

 Calculated in two phases,
 phase 1:  Photon redshift from different emitter distances as observed at R1.
 Emitter starts at 1e12 meters away from the black hole, and approaches
 all the way to 1e-24m (billionth of a proton radius, or so).
 For each emitter distance, observed frequency [Hz] and redshift [dimensionless] are displayed.

 phase 2:  Photon redshift from selected emitter distance at different observer distances.
 Observer starts at 1 meter away from the event horizon, and gains distance
 up the decades all the way to 1e18m (>100ly)
 For each observer distance, observed frequency [Hz] and redshift [dimensionless] are displayed.

 Input as optional GET parameters [with default]:
        M = mass in Msols [1]
       R1 = observer distance in meters [1.49597871e11]
       f2 = emitted frequency in Hertz' [1e20]
        d = emitter distance from event horizon in phase 2 in meters [0.001]
   DIGITS = request more decimal places for calculations [128]

 Examples:

       Solar mass black hole observed from Earth:  http://rubor.org/schwarzschildarb.php
         Same but with an emitted visible photon:  http://rubor.org/schwarzschildarb.php?f2=0.565e15
                                 Sgr A* from 1au:  http://rubor.org/schwarzschildarb.php?M=4.1e6
           Gargantua from 3au (~Miller's planet):  http://rubor.org/schwarzschildarb.php?M=1e8&R1=4.48e11
      10 Sols & emit from 1m above EH in phase 2:  http://rubor.org/schwarzschildarb.php?M=10&d=1
                Msol, visible, emitted from Rsol:  http://rubor.org/schwarzschildarb.php?f2=0.565e15&d=6.957e8
Solar mass observed from Venus, emit a microwave:  http://rubor.org/schwarzschildarb.php?f2=2.45e9&R1=108208930000

                ESA 360° black hole visualisation
                A black hole system to play in Kerbal Space Program -- aesthetic, not physical


Mass M = 1 Msol
Schwarzschild radius Rs = 1.9747458161907E-8 a.u. (2.9541776986828km)

Phase 1:  emitter moves towards event horizon
Emission distance R2 = Rs + d (variable)
Observer distance R1 = 1.495979e+11m
Emitted frequency f2 = 565000000000000.000000Hz

    d [m]          f1 [Hz]        z 
1.000000e+12	 5.650000e+14	-8.396640e-9 (-0.00)
1.000000e+11	 5.650000e+14	4.897159e-9 (0.00)
1.000000e+10	 5.649999e+14	1.378351e-7 (0.00)
1.000000e+9	 5.649992e+14	1.467214e-6 (0.00)
1.000000e+8	 5.649917e+14	1.476091e-5 (0.00)
1.000000e+7	 5.649166e+14	1.476881e-4 (0.00)
1.000000e+6	 5.641673e+14	1.475990e-3 (0.00)
1.000000e+5	 5.568349e+14	1.466337e-2 (0.01)
1.000000e+4	 4.964134e+14	1.381642e-1 (0.14)
1.000000e+3	 2.841321e+14	9.885114e-1 (0.99)
1.000000e+2	 1.022354e+14	4.526461e+0 (4.53)
1.000000e+1	 3.281681e+13	1.621679e+1 (16.22)
1.000000e+0	 1.039338e+13	5.336155e+1 (53.36)
1.000000e-1	 3.287175e+12	1.708801e+2 (170.88)
1.000000e-2	 1.039512e+12	5.425244e+2 (542.52)
1.000000e-3	 3.287230e+11	1.717772e+3 (1717.77)
1.000000e-4	 1.039514e+11	5.434235e+3 (5434.23)
1.000000e-5	 3.287230e+10	1.718672e+4 (17186.72)
1.000000e-6	 1.039514e+10	5.435135e+4 (54351.35)
1.000000e-7	 3.287230e+9	1.718762e+5 (171876.21)
1.000000e-8	 1.039514e+9	5.435225e+5 (543522.47)
1.000000e-9	 3.287230e+8	1.718771e+6 (1718771.13)
1.000000e-10	 1.039514e+8	5.435234e+6 (5435233.71)
1.000000e-11	 3.287230e+7	1.718772e+7 (17187720.32)
1.000000e-12	 1.039514e+7	5.435235e+7 (54352346.15)
1.000000e-13	 3.287230e+6	1.718772e+8 (171877212.16)
1.000000e-14	 1.039514e+6	5.435235e+8 (543523470.47)
1.000000e-15	 3.287230e+5	1.718772e+9 (1718772130.59)
1.000000e-16	 1.039514e+5	5.435235e+9 (5435234713.66)
1.000000e-17	 3.287230e+4	1.718772e+10 (17187721314.94)
1.000000e-18	 1.039514e+4	5.435235e+10 (54352347145.61)
1.000000e-19	 3.287230e+3	1.718772e+11 (171877213158.43)
1.000000e-20	 1.039514e+3	5.435235e+11 (543523471465.07)
1.000000e-21	 3.287230e+2	1.718772e+12 (1718772131593.33)
1.000000e-22	 1.039514e+2	5.435235e+12 (5435234714659.78)
1.000000e-23	 3.287230e+1	1.718772e+13 (17187721315942.40)
1.000000e-24	 1.039514e+1	5.435235e+13 (54352347146606.43)



Phase 2:  observer moves away from the horizon
Emission distance R2 = Rs + 6.957000e+8m
Observer distance R1 = variable
Emitted frequency f2 = 565000000000000.000000Hz

R1 = Rs + [m]      f1 [Hz]        z 
1.000000e+0	3.071421e+16	-0.98
1.000000e+1	9.727464e+15	-0.94
1.000000e+2	3.122444e+15	-0.82
1.000000e+3	1.123507e+15	-0.50
1.000000e+4	6.430614e+14	-0.12
1.000000e+5	5.732836e+14	-0.01
1.000000e+6	5.658327e+14	-0.00
1.000000e+7	5.650822e+14	-0.00
1.000000e+8	5.650071e+14	-0.00
1.000000e+9	5.649996e+14	0.00
1.000000e+10	5.649989e+14	0.00
1.000000e+11	5.649988e+14	0.00
1.000000e+12	5.649988e+14	0.00
1.000000e+13	5.649988e+14	0.00
1.000000e+14	5.649988e+14	0.00
1.000000e+15	5.649988e+14	0.00
1.000000e+16	5.649988e+14	0.00
1.000000e+17	5.649988e+14	0.00
1.000000e+18	5.649988e+14	0.00
1.000000e+19	5.649988e+14	0.00


Bonus GET parameters for controlling the loops: p1s = phase 1 loop start, 'outerspace', f.e. 1e24 p1d = phase 1 loop step divider, f.e. 10 or 1e1 (must be > 1) p1e = phase 1 loop end, ~event horizon, f.e. 1e-32 p2s = phase 2 loop start, ~event horizon, f.e. 1e-24 p2d = phase 2 loop step multiplier, f.e. 10 or 1e1 p2e = phase 2 loop end, 'outerspace', f.e. 1e32 Input is handled via PHPs sprintf, which limits numerical range for mass/distance to about 53 decades; the proton mass divided by solar mass is < 1e-57, and therefore proton horizon is intractable (until I maybe fix it). Example: http://rubor.org/schwarzschildarb.php?p1s=1e18&p1d=2&p1e=1e-32 Creative Commons Attribution by jussi.kantola @ gmail.com 2017 Visualizations by Professor Andrew Hamilton and used with permission. No guarantees on accuracy or correctness of the results. source code.