I think what you're looking for is:
HTML Code:
Use the formula:
y = mx+b
To find the slope, and then where the lines intersect.
Example:
y = 2x-3 Y-Intercept is -3, Slope is 2
y = x-1 Y-Intercept is -1, Slope is 1
Finding the point of interception, Use this:
rise / run
2 / 1 Up 2, Over 1
1 / 1 Up 1, Over 1
Intersection is at (2, 1), so (2, 1) is the solution.
Check if solution is correct
y = 2x-3
1 = 2(2)-3
1 = 4 - 3
1 = 1 (True)
y = x - 1
1 = 2 - 1
1 = 1 (True)
I suppose you can implement that into your script, although I am not sure how you would interpret it.