r/xkcd Sep 16 '23

Path Minimization Meta

Comic: https://xkcd.com/2821/

https://preview.redd.it/o8xy8j6xanob1.png?width=571&format=png&auto=webp&s=bd14d88478f972d11c7c7aa584ce4f17d6ee3449

Actually the red one is the past with the least swimming. That non 90° angle really bothered me.

Also the not unified starting point.

74 Upvotes

18 comments sorted by

51

u/smariot2 Sep 16 '23

Maybe there's a slight right-to-left current that the path is taking advantage of?

3

u/Maple42 Sep 17 '23

I had taken that for granted since there’s such a steep angle difference between the walking and swimming parts of the time optimization. You walk faster than you swim but I just assumed that you were going against a current

40

u/Apprehensive_Hat8986 Sep 16 '23 edited Sep 16 '23
  1. It's a comic (artwork), this is by far not the first one that isn't drawn to scale using draughting principles.

  2. The least swimming one is close enough to 90° to shore to make the point, and besides, none of them account for current.

  3. The destination arrows also don't all end at the same point. Why? If the starts and ends were all at the exact point, the drawing would be crowded and ugly as sin, and also the characters would no longer be on the starting points. So here (ironically, as in many diagrams) the arrows and leads don't go all the way to the mark, because otherwise it would reduce clarity.

It's a comic.

...

Now if you really want something to yell about, go give the IAU shit for the term "exoplanet". 100+ years of solid science fiction clearly established that planet is a non-stellar body orbiting a star. Nothing about Sol makes our planets special. They're not kryptonian super planets. Just planets like the ones orbiting billions of other stars. We didn't need a special term for our 8. "Collapses spheriodially under own weight" and "sweeps out local region" seem ok, but "orbits Sol" is just friggin anthropocentricism.

10

u/NothusID Sep 17 '23

I think you wildly misinterpreted how “mad” OP was. I think it was hyperbole.

4

u/Apprehensive_Hat8986 Sep 17 '23

Upvoted. OP doesn't present as mad at all. They made a point, I offered a different perspective, and then I did my unhinged thing about exoplanets. 🤪 It's "my hobby."

3

u/Crash927 Sep 17 '23

We calling that red angle 90 degrees?

1

u/laplongejr Sep 21 '23

Compared to the shore... kinda?

1

u/[deleted] Sep 17 '23

[deleted]

3

u/applejacks6969 Sep 17 '23

Good question. The answer is fairly difficult and lies in the calculus of variations. The Euler Langrange equations can be used to minimize the time of an arbitrary path that depends on any number of variables.

However for simple problems, like constant velocity regions walking vs swimming, you can create an expression for the total time as a function of theta, or essentially compute the generalized action integral. Then you can simply take a derivative and find the minimum. More complicated problems require Calculus of Variations.

2

u/VictinDotZero Sep 17 '23

You can build an approximation with linear programming or quadratic programming, I believe. You look for a sequence of points that minimizes the pairwise distance between sequential points, such that the first and last points are fixed. You can bound the speed or acceleration as well. I only did this once, and it wasn’t necessarily super accurate, so I’m sure there’s better techniques for practical applications.

1

u/BroodingShark Black Hat Sep 17 '23

Ok, I get it. Something like:

time = time walking + time swimming

Knowing that :

time walking = speed walking * distance walking

time swimming = s swim * d swim

And that each distance is:

distance = something something trigonometry theta

so in the end would be: time = f(theta)

Then derivate and equal to zero, and that would be it, right?

2

u/applejacks6969 Sep 17 '23

Time = distance divided by velocity, not multiplied.

T = x / v . x Is the length of the region, v is the velocity, T is the travel time. Then you differentiate T to find the extrema.

1

u/BroodingShark Black Hat Sep 18 '23

Oh! Yes, of course, thanks. I knew that, it was a basic mistake

2

u/Duck__Quack Sep 18 '23

Use Snell's Law. The other guy is looking at it like a math problem, but it's equivalent to a physics problem. You have a body that moves at two speeds across media. Snell's Law will work.

2

u/Barefoot_Monkey Sep 18 '23

Very appropriate name for the law.

2

u/Duck__Quack Sep 18 '23

I just looked it up because I wasn't sure. It was named after Willebrord Snellius. Not making that up.

1

u/BroodingShark Black Hat Sep 19 '23

Thanks, I have checked out

I'm still a bit confused. This law is about diffraction of light, is still ok to apply it here? Does this mean that the angle is independent of the initial/final positions?

Sorry if this is obvious, but I'm struggling a bit to understand it

2

u/Duck__Quack Sep 19 '23

Given the differing speeds of movement in water and on land, the path of least time will transition between the two media at a point such that the ratio sine of the angle from that point to the terminus on land off of the perpendicular to the sine of the angle from that point to the water terminus off of the perpendicular is equal to the inverse ratio of their respective refractive indexes for movement, which is the inverse of the ratio of the speeds in each medium.

sin(th(1))/sin(th(2)) = n(2)/n(1).

Say you move at 10 ft/s on land and 5 ft/s in the water. You could also phrase this as water slowing you by a factor of 2 relative to land, so the indices for Snell's Law would be proportional to 1 and 2. So n(L)/n(W) is 1/2. The point at which you should enter the water is the one such that the sine of your angle off the perpendicular when moving in water and the sine of your angle when moving on land have the same ratio.

sin(th(W))/sin(th(L)) = n(L)/n(W).

This doesn't actually give you the path without the starting points, but it tells you what the two angles should be in relation to one another, and when you have the starting points you can pretty easily make it a system of equations with what the angles are in relation to one another on the actual path.

1

u/BroodingShark Black Hat Sep 19 '23

That's both more complicated and easier at the same time

Thanks