Least Time to the Rescue

While reading Feynman’s QED: The Strange Theory of Light and Matter, I came across the analogy of comparing light to a lifeguard. Both follow the principle of least time and take the most time-efficient route between two given points. The consequence of this is that light refracts through different mediums and that a lifeguard’s most efficient path to their target is not always the same as the straight path. I created a few Python programs and a simulation using realistic values for speeds on sand and in water and standard distances to visualize the path the lifeguard would need to take in various circumstances. Using these visualization tools, I found that the difference between the optimal and straight paths is only significant when the target is close to the waterfront and far away from the lifeguard. In this case, the time saved by taking the optimal path is nearly a minute, making it vital for a lifeguard to do so. This project allowed me to combine my physics knowledge learned in school, my calculus knowledge that I taught myself, and my Python skills to simulate the lifeguard’s optimal path. The derivation of the equations used and graphs from the Python programs are in the paper below. Here is the Python code.

A screenshot from the Python simulation with the conditions described above.
Another screenshot from the Python simulation with different conditions.