Name: Dongus the dingus !p0dOyZT//A 2011-02-09 11:08
This isn't my homework.
I was writing some fucntions in python to find the intercept for a straight line.
The code it self works but I'm rather confused.
I chose some arbritary coordinates: (10,1) (1,2)
Now the gradient is -9 because (10-1)/(1-2)= -9.
To find the intercept I rearranged y = mx + c to y - mx = c and put (10,1) into it.
1 - (-9*10) = c
91 = c
To check the result I put the other coordinate in (like a good mathematician)
2 - (-9*1)= c
2 + 9 = c
11 = c
WTF BBQ!!!
My python code if you give a shit:
I was writing some fucntions in python to find the intercept for a straight line.
The code it self works but I'm rather confused.
I chose some arbritary coordinates: (10,1) (1,2)
Now the gradient is -9 because (10-1)/(1-2)= -9.
To find the intercept I rearranged y = mx + c to y - mx = c and put (10,1) into it.
1 - (-9*10) = c
91 = c
To check the result I put the other coordinate in (like a good mathematician)
2 - (-9*1)= c
2 + 9 = c
11 = c
WTF BBQ!!!
My python code if you give a shit:
def slope(x1,y1,x2,y2,):
dx=x1-x2
dy=y1-y2
grad=dx/dy
return float(grad)
def intercept(x1,y1,x2,y2):
temp=slope(x1,y1,x2,y2)
c=y1-(temp*x1)
print c