Fit a polynomial to a function of multiple parameters