MathGroup Archive 2008

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

Search the Archive

Re: Bug in Interpolation for multi-d data?


Hi,

you second example must be

dat = Flatten[
    Table[{{x, y}, Sin[x] Sin[2 y]}, {y, -3, 3, 0.1}, {x, -3, 3, 0.1}],
     1];
dat[[{1, 2, 3}]]
intp = Interpolation[dat];
ListPlot3D[Flatten /@ dat]
Plot3D[intp[y, x], {x, -3, 3}, {y, -3, 3}]

notice the intp[y,x] ...

And f[x,y] is typicla not the same as f[y,x].

Regards
   Jens

oshaughn wrote:
> Hello,
> 
> Interpolation on multi-d data gives different answers depending on the
> order in which the elements are *ordered* in the list.   As far as I
> can tell, this is not documented.
> The sorted element order seems to produce the right results.
> 
> Example 1:
> dat = Flatten[
>    Table[{{x, y}, Sin[x] Sin[2 y]}, {x, -3, 3, 0.1}, {y, -3, 3, 0.1}],
>     1];
> dat[[{1, 2, 3}]]
> intp = Interpolation[dat];
> ListPlot3D[Flatten /@ dat]
> Plot3D[intp[x, y], {x, -3, 3}, {y, -3, 3}]
> 
> Example 2:
> dat = Flatten[
>    Table[{{x, y}, Sin[x] Sin[2 y]}, {y, -3, 3, 0.1}, {x, -3, 3, 0.1}],
>     1];
> dat[[{1, 2, 3}]]
> intp = Interpolation[dat];
> ListPlot3D[Flatten /@ dat]
> Plot3D[intp[x, y], {x, -3, 3}, {y, -3, 3}]
> 
> Example 3:
> dat = Flatten[
>    Table[{{x, y}, Sin[x] Sin[2 y]}, {y, -3, 3, 0.1}, {x, -3, 3, 0.1}],
>     1]//Sort;
> dat[[{1, 2, 3}]]
> intp = Interpolation[dat];
> ListPlot3D[Flatten /@ dat]
> Plot3D[intp[x, y], {x, -3, 3}, {y, -3, 3}]
> 
> 
> Am I missing something obvious in the documentation?
> 


  • Prev by Date: 6.0.2 Standard Palettes in Windows Vista
  • Next by Date: Compile
  • Previous by thread: 6.0.2 Standard Palettes in Windows Vista
  • Next by thread: Re: Bug in Interpolation for multi-d data?