## vf321 3 years ago Hello, I have a "graphical" problem. Let's say you have two points, 1 and 2, with some initial position. Let's make the initial position vectors r10 and r20. Let the points have constant velocity vectors v1 and v2. This gives, as a function of time, r1(t) = r10 + v1*t r2(t) = r20 + v2*t The problem is to find at what time t the line segment between the two points intersects the origin. I had two approaches to this problem - The first, I made a line between the two points which changes with time and inserted x = 0 and y = 0 into the line's equation. This gave me another equation. In addition to the four equations from the vectors (2 for each from x and y), I have 5 equations, and 5 unknowns (r1, r2, and t - r1 and r2 have two unknowns each). Solving for t using Mathematica gave me one very long answer. So that solution I'm confident in. Then, I tried a different approach. I made a conjecture that if r1(t)/|r1(t)| =-r2(t)/|r2(t)| then the two position vectors must be parallel and therefore intersect the origin with the line segment. Sounds good, right? However, solving this one equation for t gave a completely different answer than that of the previous solution... And there's where I'm stuck. @telliott99 No I need to solve symbolically.

1. telliott99

Do you have actual values? Maybe a diagram will help...

2. vf321

The attached example1.pdf gives the initial condition where r1(0) = r10 = {1,1} and r2(0) = r20 = {-2,-3} The line between them, as shown, does not intersect with the origin. Also, shown, however, are velocity vectors v1 = {1,1} and v2 = {0, 1}. Thus you can guess that at t = 1, you'll have r1(1) = {2,2} and r2(1) = {-2,-2}. That, of course, goes through the origin. The answer for this case would be t = 1. But I'm looking for a symbolic answer.

3. telliott99

Sorry, but I gotta go. Great problem.

4. vf321

It's cool, right? Not a homework problem like the other poor summer school kids here...

5. vf321

Minor note about my "example" - the vector for the point {-2, -3} is off. It goes from {-2, -3} to {0,1} but it should go from {-2, -3} to {-2, -2}. Sorry.

6. experimentX

i guess equating x,y,z coordinates and solving for t would help to find the value of t.

7. vf321

Only 2D

8. experimentX

$x_1 = x_2 \implies x_{10} + t{v_x1} = x_{20} + tv_{x2}$ this will give us $t = {x_1 - x_2 \over v_{x2} - v_{x1}}$ if we put these t's in y's, both y's must have same values ... also same goes for z. that will help us to determine some unknown parameters. or if values are given for x , y, z component of velocities, it can be determined if they intersect or not based on these conditions

9. vf321

As I said, 2D only. I don't know why you're insisting with the z's. Also, I already tried solving "brute force" with mathematica. It worked, and I have a huge solution. The problem is that the huge solution is not equal to the solution I get from my second approach.

10. experimentX

2d cases only ... it's a bit simpler. do you have any other constraints for v?

11. vf321

It's a constant. I can have my solution in terms of the initial positions and the initial velocities.

12. experimentX

the condition is |dw:1343449515733:dw| if you simplify this ... you should get the required condition.

13. vf321

Yes. I know. It's solvable. That's not the problem here. The problem is that you can ALSO solve it by taking the unit position vectors, and seeing when they're antiparallel. However, that does not give the same solution. There's the problem.

14. experimentX

can you give me the solution you got from Wolf?

15. vf321

K one sec sorry was distracted with chat. The solution is not from wolfalpha, but rather MMA itself. I pasted into a document. It's really ugly.

16. vf321

r10={Ax0, Ay0}, r20={Bx0, By0}, v1= {Vax, Vay}, v2 = {Vbx, Vby}

17. experimentX

can you post the code instead?

18. vf321

If you open the word doc above, you'll see two ugly solutions to t. These were obtained by solving the system of equations given by: Ax = Ax0 + Vax * t Ay = Ay0 + Vay * t Bx = Bx0 + Vbx * t By = By0 + Vby * t (0 - Ax)(By - Ay) = ( 0 - Ay)(Bx - Ax) {this is the one that actually checks the origin to be on the line}

19. vf321

Here's the code: If you can read the nb, explaining would be so much easier lol. Also note that I use Cx and Cy because in the real problem that's the "origin." Just skp it - I replace it later with {0,0}

20. experimentX

21. vf321

Notice at the bottom of the nb I try my unit vector approach - that should work, right? Whenever I think of a line that passes through the origin, its position vectors are antiparallel. But the solutions are diff.

22. vf321

No, I don't think we can use that one. It has nothing to do with collision.

23. experimentX

man ... you sure know how to program. I'm using MMA as simple calculator.

24. vf321

Lol what do you not get bout my code? Btw, using it as a calculator is really hindering its potential. But that's another conversation. We can talk about that later

25. experimentX

Hmm ... let's say you have to particles moving to Origin with constant Velocity. (straight path) and these two particles intersect at origin right?

26. vf321

well only in certain cases, if one's moving much faster than the other then they wont intersect, but yeah, go on...

27. experimentX

well ... if it moving in straight path, the method i gave up will check weather they intersect or not. to find the time ... put x=0 and find the t. if above condition satisfies.

28. vf321

Look. Perhaphs I am not making it clear. I don't need another solution. I need to know WHY my solution failed. The one with the position vectors.

29. experimentX

this is only case of straight path ... for initial positions and velocities of both are assumed to be known.

30. experimentX

$x_{p} = x_{p0} + v_{px}t \\y_{p} = y_{p0} + v_{py}t$ $x_{q} = x_{q0} + v_{px}t \\y_{q} = y_{p0} + v_{qy}t$ these are the sets of parametric equations interms of t. if they both passes at Origin then x=0, y=0 for certain time t. since it's origin ... it's much easier. the above method is the more of general case for any point.

31. vf321

No, the problem is that the origin must be on the line segment between the two points at a specific moment in time. Not every equation can satisfy x = 0 and y = 0 for both P and Q at a give time t.

32. vf321

Anyway, I was working on the problem just now and realized the mistake I made. It is awfully specific, and would take forever to solve. Short end of it is that my first solution is wrong and the second one is right.

33. experimentX

well, x is a variable ... are you trying to find the velocity and time from given 4 points?

34. vf321

No ,no, no. Look, its hard to explain. But I solved it just now so don't worry about it.

35. experimentX

okay!! good for you that you solved!!