Mathematics with Pi – and earth measurement with network requests

In Ian Stewart’s book, Professor Stewart’s Casbook of Mathematical Mysteries, he writes about an easy way one might prove that the earth is not flat. His “easy” proof can be done by booking some flights and timing them… or, simply looking up actual flights from certain cities to other cities. If it is much much shorter for a certain flight from A to D while A to B to C to D in a nearly straight line is much longer, it’s effectively a proof you can go around the world without falling off…

That’s an interesting proof, but most of us don’t have an airplane, and this is not the time you would want to do this funny experiment… but most of us do have computer equipment. Let’s expand upon his idea by timing pings to servers around the world, and let’s see if ping times can give approximate distances… then let’s see if we can approximate the size of the earth, using pi while we’re at it, this PI day.

When you go to any website or make any web request, some computer server somewhere in the world sends back a response. We can get a list of these servers from various places, if you have a vpn subscription (and you should, for security!) you can use the list of their vpn servers. For example:

Various IPs of VPN servers around the world.

This shows various servers which are hopefully all high network throughput and give quick response times – making this a good way to see the approximate distance. Distance as the crow flies can tell us approximately how far it has to travel. Further servers take longer time to transfer data to – a ping may take 0.1 second instead of 0.05 seconds or so for nearby servers.

First we can compare the wait time (latency) of some known distances and use these to find the distances to time ratio: Using the averages from the “ping” command. Use Ctrl+C when you are done testing. For example:

$ ping 178.255.153.76
PING 178.255.153.76 (178.255.153.76) 56(84) bytes of data.
64 bytes from 178.255.153.76: icmp_seq=1 ttl=49 time=175 ms
64 bytes from 178.255.153.76: icmp_seq=2 ttl=49 time=175 ms
64 bytes from 178.255.153.76: icmp_seq=3 ttl=49 time=175 ms
64 bytes from 178.255.153.76: icmp_seq=4 ttl=49 time=176 ms
64 bytes from 178.255.153.76: icmp_seq=5 ttl=49 time=176 ms
64 bytes from 178.255.153.76: icmp_seq=6 ttl=49 time=175 ms
64 bytes from 178.255.153.76: icmp_seq=7 ttl=49 time=176 ms
64 bytes from 178.255.153.76: icmp_seq=8 ttl=49 time=175 ms
64 bytes from 178.255.153.76: icmp_seq=9 ttl=49 time=175 ms
64 bytes from 178.255.153.76: icmp_seq=10 ttl=49 time=175 ms
64 bytes from 178.255.153.76: icmp_seq=11 ttl=49 time=174 ms
64 bytes from 178.255.153.76: icmp_seq=12 ttl=49 time=175 ms
^C
--- 178.255.153.76 ping statistics ---
12 packets transmitted, 12 received, 0% packet loss, time 11001ms
rtt min/avg/max/mdev = 174.956/175.677/176.995/0.719 ms

Testing some of the above IPs, From Oregon to Denver, for example, was about 1520km and average 74ms. Dividing that, that’s 20540km/second!

Oregon to LA is 480km away and about 40ms. That’s 12000km/second!

Oregon to ny is 4015km away, and about 85ms. That’s 47235km/second!

OR to Miami is 4280km away, 96ms, that’s about 44583km/second!

OR to Atlanta is 3470km away, 100ms, that’s about 34700km/second!

OR to copenhagen is 8370 km away, 182ms, that’s about 45824km/second!

OR to amsterdam is 8350km away, 166ms average, that’s about 50301km/s!

This will be off by a bit, but you can see it is in the 40000km/s range plus or minus a good deal.

What if you could go and try from somewhere else in the world… wait… we can! There are also Digital Ocean servers, from which we can cheaply rent one and test this…

Oregon to Frankfurt, Germany is 175ms away and Singapore is about 200ms away.

To run the ping command in Singapore, to get distances from there, we can create one there! On the droplet screen create a server in Singapore region:

Choosing Ubuntu, Standard, $5/month.

The cheapest setup will be more than sufficient, and it need only be up for today, not a month. If you already have some digitalocean droplet(s) this should be pretty familiar, edit ~/.ssh/config and add another:

Host digitalTEMP
    HostName some.ip.number.here
    IdentityFile /home/username/.ssh/DigitalOcean
    User root
    Port 22

In the terminal run “ssh digitalTEMP” and you can see that pings to Singapore are 1ms! (note that the time to wait to see the command line result and send it back to your screen is not a part of “ping” command’s timings.) So how long does it take to get there to Las Angeles Digitalocean? Only 163ms. And Frankfurt? 157ms. Seems like found a faster route? Using a Digitalocean California server similarly has about 160ms wait to ping Frankfurt and… 163ms to Singapore. Although with California near Oregon I would say this all seems to not tell so much about distance as it does which, and how fast the network “pipes” that it is going through. It would be interesting to know if Digital Ocean has optimized network routes through to each of their datacenters? It might be interesting to try on Amazon AWS as well.

Now I’ve heard of the “underground internet“, but I’m sure these network requests are not going through, but around the circumference of earth (although the undersea wires are going to be a bit deeper than surface level). Although we can see by some of the above timings it isn’t really an accurate measure to see how fast requests are traveling, we should be able to estimate given some known distances, how far around the circumference of the earth is…

By string and ruler I can see on a globe, halfway around the globe is 1 ft 7 inches and Oregon to Germany is 8.5 inches across the globe. So the angle associated with 19in is pi, or, 180 degrees. What angle is it from Oregon to Germany? calculating the ratio, 19in is to pi as 8.5in is to… what angle theta(θ):

19/pi = 8.5/θ

θ = 8.5/19*pi = 1.4

and 2*pi equals 4.49 times that angle, the distance from Oregon to Germany, so by estimating the distance times 4.49, we should get an approximate distance around the whole earth:

Ping to copenhagen (“ping 188.172.192.18”) is averaging 214ms today, and a Digitalocean Germany server (“ping 142.93.97.29”) is averaging 178ms. Assuming 40000km/s or so, that averages around 192ms, and 7680km. 7680*4.49 equals 34483km, which is significantly off of the actual 40075km circumference of earth.

Really it appears network requests aren’t the best way to find distance – in fact, even a 2000 year old method of comparing the distance and angle by Eratosthenes gives the estimated circumference of earth in a similar way, much more accurately.

Leave a Reply

Your email address will not be published. Required fields are marked *

twelve ÷ two =