Ouch! Cómo dije antes, era mi primer mensaje, jeje.
Bueno, ahí va:
Código python:
Ver originali=0
n=0
while n<3:
n = int(raw_input("\n\nCuantos puntos tiene la funcion a lineaizar: "))
horizontal=vertical=range(n)
while (i<n):
print "\n"
horizontal[i]=float(raw_input("x["+str(i)+"]="))
print horizontal[i]
vertical[i]=float(raw_input("y["+str(i)+"]="))
print vertical[i]
i=i+1
print "\n"
i=0
while (i<n):
print horizontal[i], vertical[i], "\n"
i = i + 1
i=0
SUMx=SUMy=SUMxy=SUMxx=a=b=0.0
while (i<n):
print SUMx, SUMy, SUMxy, SUMxy, "\n"
SUMx = SUMx + horizontal[i]
SUMy = SUMy + vertical[i]
SUMxy = SUMxy + (horizontal[i]*vertical[i])
SUMxx = SUMxx + (horizontal[i]*horizontal[i])
i = i + 1
print SUMx, SUMy, SUMxy, SUMxy, "\n"
a = ( (SUMx*SUMy) - (n*SUMxy) ) / ( (SUMx*SUMx) - (n*SUMxx) )
b = ( SUMy - (a*SUMx) ) / n
print a,"x",
if b>=0:
print "+",
print b