analytics

Sunday, December 30, 2012

Returning 1 if two parametric functions cross

I found this equation which given two parametric equations t and u both of x and y, evaluates to 1 if the two parametric equations are equal or alternatively whether they cross:
For instance:
It equals 1 because the functions cross at some point:

The proof is:
Inside the integral are two Dirac functions, set up so that they are both Dirac(0) only when x(t)=x(u) and y(t)=y(u). The Dirac function is only non-zero (infinite) at Dirac(0). The product of the two will only be non-zero if both are non-zero. Hence the integral over the domain of u and t will be greater than 0 if the two parametric equations are ever equal. The Heaviside function returns 1 if x is greater than or equal to 0 so the function will be one when the parametric equations are ever equal over the two intervals. 

This one was kind of frustrating to develop because when I had the idea this is one of the forms of it I tried first, but I had a small mistake so I thought it didn't work and then worked on it for several days trying all kinds of different things until finally I tried it again and got it to work. It can be adapted to other types of equations. In practice it takes Maple a second to evaluate the integral so it might be faster to solve the equations, but maybe the form of this is useful or interesting besides the strict application of it. 
You might wonder why I didn't do it in one of several other ways, like the Dirac of the distance function between the two equations... It turned out that those were impossible for Maple to solve while this one works well. 



No comments:

Post a Comment