2
$\begingroup$

I need to (numerically, specifically in C++) solve for the intersection point of two curves, f(x) and g(x). I am given two sets of data, one for each curve (eg. {($x_1$,f($x_1$)),($x_2$,f($x_2$)),($x_3$,f($x_3$))....} and {($x_4$,g($x_4$)),($x_5$,g($x_5$)),($x_6$,g($x_6$))....}). The intersection point lies outside of the two sets, and none of the $x_i$ values in "f-set" are in "g-set" (excuse the wording). The solution therefore involves some iterative loop of (a) extrapolation to a guess $x_n$ and calculating $f(x_n)$ and $g(x_n)$, and (b) checking some relation between these two values to see if $x_n = $ or $ > $ or $ < x_{intersection}$.

If you like, you can visualize this problem as follows: you are given points on two sides of a triangle, and you would like to extrapolate these points to find the corner point. However, in general, the curves $f$ and $g$ are not straight lines.

Could you please walk me through the methods used to solve this problem?

  • 0
    Unfortunately, no. The shapes are generally smooth, but could really be anything. I guess I could just try a cubic spline, but then what is an efficient method to solve for the intersection of two cubic splines?2012-07-10

0 Answers 0