This is my code (it's an example of a larger piece of code):
from scipy.optimize import curve_fit
def func(x, a, b):
return a + b*x
xlist = [10, 30, 50, 70, 90, 110, 130, 150, 170, 190, 210, 230]
ylist = [0.0074999999999999997, 0.011875, 0.0057812499999999999, 0.0036458333333333334, 0.0020312500000000001, 0.0013125000000000001, 0.00098958333333333342, 0.00089285714285714283, 0.00074218750000000001, 0.00093749999999999997, 0.00071874999999999999, 0.00088068181818181821]
popt, pcov = curve_fit(func, xlist, ylist)
print(popt[0], popt[1])
As you can see I'm attempting a very simple fit with a very simple a + b*x
function. The issue is that this returns the values:
(-119.99689110581872, 1.0)
for a=popt[0]
and b=popt[1]
but the same fit with zunzun.com gives much more reasonable values:
a = 7.8372289537296004E-03
b = -3.9402329475524466E-05
for the exact same function.
What am I doing wrong here?
Edit
Warren below stated this might be a bug. Should I report it as such or is this the expected behaviour?