       Re: Fit or Interpolate

• To: mathgroup at smc.vnet.net
• Subject: [mg39231] Re: Fit or Interpolate
• From: Bill Rowe <listuser at earthlink.net>
• Date: Tue, 4 Feb 2003 02:23:45 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```On 2/3/03 at 1:10 AM, sophtwarez at hotmail.com (David Seruyange) wrote:

>What is the difference between using Fit and Interpolation?
>f[x_]=Fit[data, {1,x},x] -or- f[x_]=Interpolation[data][x]

There are several differences between the expressions above

First, Interpolation[data][x] isn't correct syntax. It should be Interpolation[data]. Interpolation returns a pure function of data. By default that is a 3rd order polynominal that passes through each of the points specified by the variable data.

In contrast, Fit[data,{1,x},x] returns a best fit *line* for the points specified by data. The result is not a pure function but an expression. The result is a least squares fit to the data and will not pass through the points specified unless they lie exactly on a line.

The two functions, Interpolation and Fit, are intended for different purposes.

Suppose you had a list of data points that were known to be accurate to the precesion specified and wanted to estimate the value of the unknown function at an intermediate point. For this you would use interpolation since you want the result to pass through each of the data points you started with.

Now suppose you had a list of data points where each data point you have is really the sum of a true value and a random error. The best result would ideally subtract out the error and yeild the true values.  So, you would definitely not want the result to pass through the points with error. For this problem you would use Fit.

```

• Prev by Date: Re: Another plea for help...
• Next by Date: Re: To verify Cauchy-Riemann relations in complex variable graphically
• Previous by thread: Re: Fit or Interpolate
• Next by thread: Re: Re: Fit or Interpolate