Contents

Manually Computing Travel Times for Long-Distance Flights and Space Travel: Uncovering the Precise Power-Law Relationship between Travel Time and Distance

Contents

One day, a curious person (me) decided to explore an interesting question: how does the time it takes to travel from point A to point B scale with distance, in the real world? They knew that travel time would grow slower than linearly, but they wanted to know exactly how it scaled.

In an attempt to see how travel time scales with distance in the real world, taking into account the different modes of transport available for various distances, I decided to explore this question by randomly selecting points from the GeoLife dataset where people are actually present, primarily in Seattle and Beijing, but with occasional visits to other cities. Using public transport to travel between these points, I asked ChatGPT to write a script to extract a randomly selected coordinate from each file. While it did make the mistake of assuming every item in the list was a number, I fixed it manually.

With this script, I was able to get randomly selected points and an API to get the public transit travel time between them. I asked ChatGPT for more coding help to get an API key for the Google Maps Directions API, write a function to compute the straight-line distance between two GPS coordinates, draw a scatter plot with distance and time as axes and both axes logarithmically scaled, and do a linear regression on the logarithms of distance and time to fit the data to a power law. While it bugged on the first attempt to do a linear regression, it succeeded on the second attempt.

This gave me a nice set of data that was filtered for distances under 500km, as distances over 500km would likely involve flying, which was not taken into account by Google Maps. I obtained data for longer distances manually, which involved selecting points more than 500km apart, getting public transit travel time from the starting point to the nearest airport, getting travel time from the end point to the nearest airport, and computing the travel time as (to_airport) * 1.5 + (90 if international else 60) + flight_time + from_airport. I did this for 16 cases, eight of which were within the United States and eight with at least one end outside the United States, skipping over city pairs that had already been covered.

Finally, I added data for how long it would take to travel to various locations in space, such as the moon, Mars, Pluto, and Alpha Centauri, for fun. My complete code can be found here.

https://vitalik.ca/images/traveltime/chart1.png

From the resulting chart, it appears that there is a precise relationship governing travel time as a function of distance.

To answer this question, they turned to ChatGPT 3.5, a large language model trained by OpenAI, and asked for help. They asked for the GeoLife dataset, which contains information about users' locations around the world, and wrote a script to randomly select a coordinate from each file.

With these coordinates, they used an API to get the public transit travel time between the points, and asked ChatGPT for more coding help, including how to get an API key for the Google Maps Directions API, how to compute the straight-line distance between two GPS coordinates, and how to draw a scatter plot of travel time versus distance.

Using the scatter plot, they noticed a power-law relationship between travel time and distance, and did a linear regression on the logarithms of distance and time to fit the data to a power law. The resulting fit was: travel_time = 965.8020738916074 * distance^0.6138556361612214 (time in seconds, distance in km).

However, they wanted to get travel time data for longer distances, where the optimal route would include flights. APIs were not available for this, so they resorted to doing it manually. They used the same script to select pairs of points that were more than 500km apart, and manually obtained travel time data for the first 8 results within the United States, and the first 8 with at least one end outside the United States.

To compute the travel time for each pair, they used a formula that included the public transit travel time to and from the airport, flight time, and an aggressive estimate of when to leave for the airport. They added data for how long it would take to travel to various locations in space, including the moon, Mars, Pluto, and Alpha Centauri.

The resulting chart showed a surprisingly precise relationship between travel time and distance, with a power-law fit of: travel_time = 733.002223593754 * distance^0.591980777827876 (time in hours, distance in km). This led the curious person to wonder about the underlying physics and mathematics that govern this relationship.