Download MetaTrader 5

If 2 cars are travelling in the same direction and ....

To add comments, please log in or register
Share your program via Code Base. Gain access to millions of traders!
Ian Venner
2584
Ian Venner 2013.12.03 15:32 

This is related to movement of indicators but is easy to write with cars.

Two cars travelling in the same direction car A is 10 miles behind car B, Car A is travelling 2x faster than car B. How many miles further down the road will Car A catch up with car B. The answer is 10 miles.

But if car A is travelling 3x faster the answer is 5 miles.

4X faster is a little over 3 miles (rough calculation in my head)

It looks like I should be able to use a formula to calculate that but I am not seeing it.

user_123
172
user_123 2013.12.03 16:10  

The formula is: 10/(V(a)-V(b))


V(a) = velocity of car A

V(b) = velocity of car b


example car A is 4X faster:


10/(4-1)=3,33

Ian Venner
2584
Ian Venner 2013.12.03 16:30  

Damn yeah why didnt I see that, it seems obvious now you showed me, but I puzzled over it all morning. Thanks for your help.

Alain Verleyen
Moderator
30728
Alain Verleyen 2013.12.03 16:46  
user_123:

The formula is: 10/(V(a)-V(b))


V(a) = velocity of car A

V(b) = velocity of car b


example car A is 4X faster:


10/(4-1)=3,33

Your formula isn't right, as it suppose Vb=1.

The right formula is : d = 10 * Vb / (Va - Vb)

which can be simplified in case where Va = x * Vb (a is x times faster than b), by d = 10 / (x - 1).

EDIT: Va is speed of car a, Vb is speed of car b in this formula.

Ian Venner
2584
Ian Venner 2013.12.03 17:12  

I think the original formula is right because we are calculating on the basis of Va relative to Vb so no matter what Va is, Vb will always be 1 but I agree that your d/(x-1) is the better formula

Alain Verleyen
Moderator
30728
Alain Verleyen 2013.12.03 17:17  
SDC:

I think the original formula is right because we are calculating on the basis of Va relative to Vb so no matter what Va is, Vb will always be 1

Nope, but it's as you wish.
Ian Venner
2584
Ian Venner 2013.12.03 17:23  

if a is 3 times faster than b then how can b be anything but 1 ? b can only be 1x faster than b.

whroeder1
14489
whroeder1 2013.12.03 17:51  
user_123: The formula is: 10/(V(a)-V(b))
y1 = m1 x + b1
y2 = m2 x + b2
y1-y2 = (m1-m2)x + (b1-b2) = 0 // at cross
 x = (b2-b1) / (m1-m2)         // when cross
                               // b2-b1 = 10 miles
Alain Verleyen
Moderator
30728
Alain Verleyen 2013.12.03 19:55  
WHRoeder:

And what is m1, m2, (m1-m2) ?
Alain Verleyen
Moderator
30728
Alain Verleyen 2013.12.03 20:20  
SDC:

if a is 3 times faster than b then how can b be anything but 1 ? b can only be 1x faster than b.

Va is velocity of car a, Vb is velocity of car b.

Vb can be 10miles/hour or 100miles/hour, why do you want it to be 1 ? If it's 1mile/hour then Va=x*1mph=2mph (or 3mph or 4 mph). But Vb don't have to be 1mph, it can be 75mph, then Va is 150mph (or 225mph or 300mph).

In all case, if ratio of Va/Vb=2 (=x) then the distance you asked is got by d=10/(x-1)=10/(2-1)=10 miles.

If you have Va and Vb and don't want to calculate the ratio then d=10*Vb/(Va-Vb)=10*75/(150-75)=10 miles.

EDIT: When I wrote velocity above, I mean in fact speed.

whroeder1
14489
whroeder1 2013.12.03 20:55  
angevoyageur: And what is m1, m2, (m1-m2) ?
Speed of Car1, of car2, difference in speeds. I was simply trying to show how user_123 came up with the equation 10/(Va-Vb) . Slopes [y=mx+b] if you're talking lines, speed [x(t) = vt + x0] if you're talking cars. Velocity is a vector (speed plus direction) and since they are assumed to be on the same road direction is constant.
12345
To add comments, please log in or register