The problem I'm trying to solve is to algorithmically figure out whether two curves converge or diverge in a graph (visually the problem is almost trivial). For examples:
The left one is convergence, and the right is divergence. Note that the in both cases, the two curves may or may not have intersection(s), though in the examples above the intersections helps illustrate the problem visually.
EDIT - Thanks to @JonathanLisic helpful comments, here I attempt to refine the notion of convergence and divergence. By convergence, I intend to mean that the the difference in
Y between the two curves decreases as
X increases, and the two curves intersect at least once, and after the first intersection, the difference in
Y remain small (so they either intersect a few more times or remain disconnected with some small difference(s) in
Y (being parallel would be a special case to this)). Conversely, by divergence, I intend to mean that the difference in
Y between the two curves increases as
X increases, and the two curves do not intersect except possibly at the beginning. Again, becoming parallel beyond some
X is a special case.
A possible solution is to first calculate the absolute values of the differences between the two curves, and fit a curve/function with the differences. For example, I can try to fit a straight line to the differences data, and if the slope is negative then I may conclude that the two curves converge. Otherwise, they may be diverging.
However, I realize that fitting a straight line may be very crude, as the difference may get smaller and then larger over the range of x-axis, or vice versa.
So what would be an ideal approach for curve fitting here?