How to use it
- Type the x values and the y values, one y for each x. Separate numbers with commas, spaces or semicolons.
- Pick the fit: linear, exponential, quadratic, cubic or quartic.
- Optionally enter an x to predict the y the curve gives there. It is marked on the plot.
- The address bar holds your data and your choice, so a link brings the same fit back.
What the fits do
All the polynomial fits are least squares: they choose the coefficients that make the sum of squared vertical distances from the points as small as possible, by solving the normal equations (XᵀX)c = Xᵀy. The exponential fit y = a·e^(bx) takes the logarithm of y, fits a straight line to (x, ln y), and turns the intercept back into a. That minimises the error in ln y, not in y, which is what spreadsheets and graphing calculators do too; both R² values are shown.
R² is the share of the variation in y that the curve explains, 1 − SS_res / SS_tot. Adding a degree never lowers R², so a quartic through six points looks better than it is. With as many coefficients as points the curve passes through everything and R² = 1 says nothing.
Example. The points (1, 2), (2, 4), (3, 5), (4, 4), (5, 5) give the line y = 0.6x + 2.2 with R² = 0.6.