# Shortest time from a point to a moving point

1. Sep 15, 2004

### yang

Lets say you have 2 points A and B. A is given as (x, y) and B is a point that revolves on a circle. You are given the radius (r), the initial angle (i), and the velocity that it travels at (v_b). You are also given the velocity that A travels at (v_a). The center of the circle is (0,0) and all points relate it that point.

http://img90.exs.cx/img90/8300/pic32.jpg

You want to find the shortest amount of time it takes for A to reach B.

To do it in the shortest amound of time, A must travel in a straight line. In order to do that, you must know where B will be in the same amount of time it takes A to get there.

I've created 2 equations for distance that relate to time.

d(t) = sqrt( (x - rcos(at + i))^2 + (y - rsin(at + i))^2 )
d(t) = (v_a)t

These combine to make

(v_a)t = sqrt( (x - rcos(at + i))^2 + (y - rsin(at + i))^2 )

*note: sqrt = square root

d = distance (variable)
t = time (variable)
x = x-coordinate of A (constant)
y = y-coordinate of A (constant)
r = radius (distance from (0,0) to B) (constant)
i = initial angle (constant)
v_a = velocity of A (constant)
v_b = velocity of B (constant)
a = angular velocity (v_b / r) (constant)

The thing that is wrong with this equation is that you cannot isolate t, but you can use it to approximate t.

I've tried finding d'(t) and (d^2)''(t) to eliminate t from one of the functions (I'm not sure they are functions).

d'(t) = ( axrsin(at + i) - ayrcos(at + i) ) / sqrt( (x - rcos(at + i))^2 + (y - rsin(at + i))^2 )
d'(t) = v_a

(d^2)''(t) = 2(a^2)xrcos(at + i) + 2(a^2)yrsin(at + i)
(d^2)''(t) = 2(v_a)^2

But, these functions don't help in finding t.

The main purpose is to find the shorest amount of time it takes for A to get to B.

So, there's got to be another method, right?

2. Sep 15, 2004

### Tide

Exactly what is varying that would allow you to get different "arrival times?"

3. Sep 16, 2004

### HallsofIvy

Let (x0,y0) be the initial point of A. I will assume, from your picture, that B's initial point is (0, r). Let ω be the angular speed of B in radians per sec (if your vB is in linear units per second, then ω= vB/r). The position of B at any time t is (r cos(ωt), rsin(ωt)).

Assume that A moves in a straight line making angle θ with the x axis at (linear) speed vA. Then the position of A at any time t is (x0+ vAcos(θ)t, y0+ vAsin(θ)t) (Notice that the t is NOT in the trig function here! cos(θ) and sin(θ) are constants!).

When "A reaches B" these two points must be the same for the same t. That gives two equations: r cos(ωt)= x0+ vAcos(θ)t and rsin(ωt)= y0+ vAsin(θ)t to solve for the two "unknowns", t and θ.

I suspect you won't be able any "closed formula" solution for t.

(I suppose you put this in the "calculus" section because of the "minimum time" requirement but once you recognize that the minimum time, with constant speed, is on a straight line, you don't need calculus.)

(Tide: to answer your question, I am assuming that it is the initial position of A, (x0,y0), that is varying.)

Last edited by a moderator: Sep 16, 2004
4. Sep 16, 2004

### Tide

Halls,

I thought of varying the initial position too but then the obvious answer is to simply place A at the initial position of B, i.e. tmin = 0!

5. Sep 16, 2004

### HallsofIvy

Well, yes, but I assumed the problem was: determine the shortest time to go from A at (x,y) to B as a function of (x,y).

6. Sep 16, 2004

### yang

Oh. That's another approach i didn't think of. I think you forgot to put the intial angle in the sin and cos functions for B. This method sets θ in relation to t, instead of distance in relation to t. This just as bad as my 2 equations for d(t) because you have t outside and t inside sin and cos functions. And how would you find θ?

Also, θ is in terms of t. So what would θ equal if written in terms of t?

This problem is what i think is the core of the "Cosmic Milkman" problem from Code Wars.

http://www.hpcodewars.org/PastEvents/CodeWarsV/Problems/Milkman.htm [Broken]

You can read that if you want to understand the entire problem.

I have a thread in another website, too.

http://www.sosmath.com/CBB/viewtopic.php?t=9662

Last edited by a moderator: May 1, 2017