POLYFIT performs a least squares fit of a series to:

POLYFIT returns the coefficients of the above power series.

POLYGRAPH graphs the polynomial with the given coefficients for the data points in the x data series. For example, in W1

polyfit(gline(100, .01, 1.0, 1.0)^3, 3)

returns a 4 point series with values {1, 3, 3, 1} as the resulting third order coefficients. In W2

polygraph(w1, xvals(w1))

graphs the fit. POLYGRAPH optionally creates an ASCII file names "polyn.fit" (where n is the nth fit performed) that contains some statistics on the resulting fit.