tags:

views:

367

answers:

1

I tried this unsuccessfully:

find_fit(data, quadratic_residues)

I am trying to find the best-fit for data about water flow rates: http://dl.getdropbox.com/u/175564/rate.png

---edit after the comment---

The new code:

var('x')
model(x) = x**2
find_fit((xlist, reqlist), model)

The error message:

Traceback (click to the left for traceback)
...
TypeError: data has to be a list of lists, a matrix, or a numpy array

---edit

The error message is now:

Traceback (click to the left for traceback)
...
ValueError: each row of data needs 2 entries, only 5 entries given

The same here as a picture: http://dl.getdropbox.com/u/175564/sage.png

+1  A: 

I think your problem is that quadratic_residues probably doesn't mean what you think it means. If you are attempting to fit the best quadratic model I think you want to do something like.

var('a, b, c, x')
model(x) = a*x*x + b*x + c
find_fit(data, model)
Steven Noble
Thank you for the correction! I simplified your code. However, I have not get it to work: var('x')model(x) = x**2find_fit((xlist, reqlist), model)
Masi
try putting the free coefficients "a,b,c" back in
Steven Noble
The same problem still: http://dl.getdropbox.com/u/175564/sage.png
Masi