Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Interpolation does not quite interpolate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81822] Interpolation does not quite interpolate
  • From: Neil Stewart <neil.stewart at warwick.ac.uk>
  • Date: Thu, 4 Oct 2007 04:24:43 -0400 (EDT)
  • Reply-to: Neil Stewart <neil.stewart at warwick.ac.uk>

I'm having trouble with Interpolation[]. With InterpolationOrder->0,
Interpolation[] returns a function that fails to "agree with data at every
point" as promised in the manual. When InterpolationOrder->1 or higher,
the problem disappears.

Here is an example. Notice that although the point {1,1} is specified f[1] =
2.

In[1]:= f = Interpolation[{{1, 1}, {2, 2}, {3, 3}}, InterpolationOrder -> 0]
Out[1]= InterpolatingFunction[{{1, 3}}, <>]

In[2]:= f[1]
Out[2]= 2       (* f[1] should be 1 *)

In[3]:= f[2]
Out[3]= 2

In[4]:= f[3]
Out[4]= 3

In[5]:= g = Interpolation[{{1, 1}, {2, 2}, {3, 3}}, InterpolationOrder -> 1]
Out[5]= InterpolatingFunction[{{1, 3}}, <>]

In[6]:= g[1]
Out[6]= 1       (* f[1] is 1 now *)

In[7]:= g[2]
Out[7]= 2

In[8]:= g[3]
Out[8]= 3

Is this a bug? Can anyone help?

Thanks,
Neil



  • Prev by Date: Re: Re: Equivalent functionality to colorbar in Mathematica?
  • Next by Date: Re: Precision when solving a system of differential equations
  • Previous by thread: Re: Functions with data hidden in them
  • Next by thread: Re: Interpolation does not quite interpolate