Bug in Interpolation for multi-d data?
- To: mathgroup at smc.vnet.net
- Subject: [mg85979] Bug in Interpolation for multi-d data?
- From: oshaughn <oshaughn at northwestern.edu>
- Date: Fri, 29 Feb 2008 06:24:30 -0500 (EST)
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?