CoCalc Public FilesDiscussion Feb 17 / X_int.ipynbOpen with one click!
Authors: Wadud Khan, Johann Thiel
Views : 69
Description: Discussion Feb 17
Compute Environment: Ubuntu 20.04 (Default)
In [2]:
def x_int (m,b): x= -b/m return x

The x-intercept of any line is where the y value is 0

to find the x intercept, we then simply solve for x if the equation of the line is in point-slope form

this code assumes y is zero and just calculates for x when given m and b

for a line y=4x+5:

In [5]:
x_int(4,5)
-1.25

For a line y=100x+20:

In [3]:
x_int(100,20)
-0.2
In [ ]: