leastSquaresFit()
General non-linear least-squares fit using the Levenberg-Marquardt algorithm and automatic derivatives.
The parameter model specifies the function to be fitted. It will be called with two parameters: the first is a tuple containing all fit parameters, and the second is the first element of a data point (see below). The return value must be a number. Since automatic differentiation is used to obtain the derivatives with respect to the parameters, the function may only use the mathematical functions known to the module FirstDerivatives.
The parameter parameter is a tuple of initial values for the fit parameters.
The parameter data is a list of data points to which the model is to be fitted. Each data point is a tuple of length two or three. Its first element specifies the independent variables of the model. It is passed to the model function as its first parameter, but not used in any other way. The second element of each data point tuple is the number that the return value of the model function is supposed to match as well as possible. The third element (which defaults to 1.) is the statistical variance of the data point, i.e. the inverse of its statistical weight in the fitting procedure.
The function returns a list containing the optimal parameter values and the chi-squared value describing the quality of the fit.
polynomialLeastSquaresFit()
Least-squares fit to a polynomial whose order is defined by the number of parameter values.