Solving Ball Collision Equation



Barton Willis <willisb at unk.edu> writes:

> -----maxima-bounces at math.utexas.edu wrote: -----
>
>>hi,  I am new to maxima and I would like to solve this equation:
>>([px1,py1] + t*[vx1,vy1] - ([px2,py2] + t*[vx2,vy2]))^2 = (r1+r2)^2
>>for t.

hello Barton,

> In Maxima, [a,b] is a list with two items. So the left side of your equation is a list, 
> but the right side is not a list. Also, [a,b]^2 = [a^2,b^2]. Once you express the 
> equations as two scalar equations, solve might work OK.

Thanks for the explanation! I don't know how to formulate this with two
equations, but this works fine (simply Pythagorean Theorem):

  solve([(px2+t*vx2 - px1-t*vx1)^2 + (py2 + t*vy2 - py1-t*vy1)^2 = (r1+r2)^2], t);

Best Regards!
-- 
Felix Natter