# Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

# FindFit

FindFit[data,expr,pars,vars]
finds numerical values of the parameters pars that make expr give a best fit to data as a function of vars.

FindFit[data,{expr,cons},pars,vars]
finds a best fit subject to the parameter constraints cons.

## Details and OptionsDetails and Options

• The data can have the form {{x1,y1,,f1},{x2,y2,,f2},}, where the number of coordinates x, y, is equal to the number of variables in the list vars.
• The data can also be of the form {f1,f2,}, with a single coordinate assumed to take values 1, 2, .
• FindFit returns a list of replacements for par1, par2, .
• The expression expr must yield a numerical value when pars and vars are all numerical.
• The expression expr can depend either linearly or nonlinearly on the pari.
• In the linear case, FindFit finds a globally optimal fit.
• In the nonlinear case, it finds in general only a locally optimal fit.
• FindFit[data,expr,{{par1,p1},{par2,p2},},vars] starts the search for a fit with {par1->p1,par2->p2,}.
• FindFit by default finds a leastsquares fit.
• The option NormFunction->f specifies that the norm f[residual] should be minimized.
• The constraints cons can contain equations, inequalities, or logical combinations of these.
• The following options can be given:
•  AccuracyGoal Automatic the accuracy sought EvaluationMonitor None expression to evaluate whenever expr is evaluated Gradient Automatic the list of gradient components for expr MaxIterations Automatic maximum number of iterations to use Method Automatic method to use NormFunction Norm the norm to minimize PrecisionGoal Automatic the precision sought StepMonitor None expression to evaluate whenever a step is taken WorkingPrecision Automatic the precision used in internal computations
• The default settings for AccuracyGoal and PrecisionGoal are .
• The settings for AccuracyGoal and PrecisionGoal specify the number of digits to seek in both the values of the parameters returned, and the value of the NormFunction.
• FindFit continues until either of the goals specified by AccuracyGoal or PrecisionGoal is achieved.
• Possible settings for Method include "ConjugateGradient", "Gradient", "LevenbergMarquardt", "Newton", "NMinimize", and "QuasiNewton", with the default being Automatic.

## ExamplesExamplesopen allclose all

### Basic Examples  (1)Basic Examples  (1)

Find a nonlinear fit to a list of primes:

 In[1]:=
 Out[1]=

Fit the best-fit parameters , , and :

 In[2]:=
 Out[2]=

Evaluate the fitted function:

 In[3]:=
 Out[3]=