My darling, struggling in the ocean! The last story for class.
I am standing on a straight beach and my darling is swimming in the ocean, a quarter mile from shore. The closest point to my darling is two miles down the beach. The sharks attack, and I must get to my darling as soon as possible. I can run a mile in 10 minutes and swim a mile in 40 minutes. How can I get to my darling in the least time?
As I mentioned in class, this is actually not such a toy problem. Similar problems arise in optics frequently: minimizing travel time when the speed in different materials varies. I've attempted to sketch the situation, as seen from "above". How can I get from my initial position to my darling?
Pure strategy #1 Swim all the way! Swim directly. The distance is sqrt((1/4)2+22), about 2.01555 miles. At 40 minutes per mile, this takes about 80.6226 minutes.
Pure strategy #2 Run as much as possible. I run 2 miles down the beach, and then swim. So the 2 miles running take me 20 minutes, and the 1/4 mile swimming takes 10 minutes. The total time is 30 minutes.
A "mixed" strategy? Run for a while, then swim. It is not clear but maybe some blend of the two is faster. So I could run part of the way, and then swim directly to my darling.
Suppose the "breakpoint" between these two activities is x miles from the point on the beach which is closest to my darling. Then I'd run 2-x miles, which would take 10(2-x) minutes. I would need to swim the length of the hypotenuse of a triangle with legs x and 1/4 long: that's sqrt(x2+(1/4)2) miles, and that would take 40sqrt(x2+(1/4)2) minutes. The total time would be f(x)=10(2-x)+40sqrt(x2+(1/4)2). The domain of interest is [0,2].
Amazing!!! To the right is a fairly careful graph of f(x). Notice that there is a critical point in the interval [0,2]. The critical point is close to 0. I used my "friend" Maple to find the critical point. Partly this is because I am lazy, but it is more because I am tired. This computation could be done by hand, because the most "difficult" part of it is just solving a quadratic question. The first instruction defines f as the algebraic mess we have above. Maple echos the definition so that I can check it is what I want (I make lots of typing errors!). The second instruction differentiates this formula. The third instruction, using the wordsolve sets the previous expression (that is what % means) equal to 0. The answer is exact and comes from the quadratic formula. Then I substituted this into the expression for f. Since I didn't "understand" the expression, I used evalf finds a 10 digit approximation to the answer.
> f:=10*(2-x)+40*sqrt(x^2+(1/4)^2); 2 1/2 f := 20 - 10 x + 10 (16 x + 1)
At the all swimming endpoint, the time needed was about 80.6226 minutes. At the most running endpoint, the time needed was 30 minutes. The ideal strategy (at least for minizing time!) gets me to my darling in less time than that: 29.6824 ... minutes. I will certainly happily admit that this is not a great difference in time. But you should see that there is a difference, and in other problems the difference might be significant. The speed of light in vacuum (air is about the same) is 299,792,458 meters per second (I copied this!). This speed is frequently called c. "Denser media, such as water and glass, can slow light much more, to fractions such as 3/4 and 2/3 of c." This difference is responsible for light "bending" or refracting, because light travels (!) to minimize time.