Fit Command

Fit( <List of Points>, <List of Functions> )

Returns a linear combination of the functions that best fit the points in the list.

  • Fit({(-2, 3), (0, 1), (2, 1), (2, 3)}, {x^2, x}) yields 0.625 x^2 - 0.25x.

  • Let L = {A, B, C, …​}, f(x) = 1, g(x) = x, h(x) = e^x, F = {f, g, h}. Fit(L, F) calculates a function of the form a + b x + c e^x that fits the points in the list.

Fit( <List of points>, <Function> )

Returns a function that fits the points in the list with minimum squared error with respect to the specified model. The given model function must depend on one or more sliders, that are taken as start values of parameters to be optimized. The non-linear iteration might not converge, but adjusting the sliders to a better starting point might help.

Let a be slider with interval from -5 to 5 and increment 1. Fit({(-2, 3), (0, 1), (2, 1), (2, 3)}, a + x^2) yields -1 + x^2.