Click here to Skip to main content
15,877,168 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi All

I am drawing linear and rational function in canvas.I have 2 arrays of points for linear and rational respectively. my requirement is to find the intersection of this two equation. since we dont have static formula for this to find intersection.please refer me some code in any tagged languages

thanks in advance
nv3 21-Aug-14 11:47am    
If you only know that the second function is "rational" then there is no general solution. If the second function is a polynomial, then things are better and you can recover the closed form (formula) of the function if you have enough points.

For the general case, just determine for every neighboring pair of points of your rational function if the linear function intersects in this interval. This is easy as it is only determining the intersection of two lines. If yes, you have found one intersection of the two functions; there may be several.

Ready made code: You probably won't find any. So you will have to program a couple of lines by yourself.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900