Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One option is to use find_fit.

Here is some sample code.

# example data
f(x,y) = x^2+y^2
data=[]
for i in range(0,10):
    for j in range(0,10):
        data.append([i,j,f(i,j)])

# do the fitting
var('a b c')
model(x,y)=a*x^2+b*x*y+c*y^2
find_fit(data,model)