Re: Re: Fit or Interpolate

• To: mathgroup at smc.vnet.net
• Subject: [mg39245] Re: [mg39231] Re: Fit or Interpolate
• From: Dr Bob <drbob at bigfoot.com>
• Date: Wed, 5 Feb 2003 00:11:53 -0500 (EST)
• References: <200302040723.CAA24653@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Interpolation[data][x] is perfectly good syntax.  For instance:

data = {#, #^3 + Random[]} & /@ Range[0, 5, 0.2];
x=3;
Interpolation[data][x]

27.9333

Bobby

On Tue, 4 Feb 2003 02:23:45 -0500 (EST), Bill Rowe <listuser at earthlink.net>
wrote:

> 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.
>
>

--
majort at cox-internet.com
Bobby R. Treat

```

• Prev by Date: Interpolation over an irregular surface