Message Boards Message Boards

Interpolation for multi-dimensional functions

Posted 8 years ago
POSTED BY: Rene Samson
10 Replies
Posted 8 years ago

Hi Sander, Thanks for pointing me in the right direction for help and documentation. Thanks, René

POSTED BY: Rene Samson
Posted 8 years ago

Hi Frank,

I've just tested your proposal on my dataset and your suggestion to apply Union[] did the trick. It actually didn't compress my data set, so apparently the problem was not a result of duplicates but of disorder. I had actually tried to fiddle around with this on my own, without realizing that Union[] also orders multi-dimensional sets. Now the Interpolation[] function works without any hickups. WONDERFUL!! I am really thankful to you for pointing this out to me. You saved my day!! Thanks again. (Suggestion to the professional Wolfram crowd: Wouldn't it be nice to give this as an example in the help documentation for Interpolation? I am probably not going to be the first or the last person to run into this difficulty with multi-dimensional functions). René Samson

POSTED BY: Rene Samson
POSTED BY: Sander Huisman
POSTED BY: Frank Iannarilli
Posted 8 years ago
POSTED BY: Rene Samson

Hi Rene,

My guess is that some of your data samples are duplicates (in {x.,y}) or nearly so. To detect them, you might try processing the {x,y} components of your data set through the Union[] function. Does Union return a list of the same Length[] as the one you submitted as its argument? A refinement is to look for small differences between {x,y}i and {x,y}j by using the SameTest option of Union:

sortedList=Union[myList,SameTest-> (Abs[#1[[1]]-#2[[1]]]<epsilon || Abs[#1[[2]]-#2[[2]]]<epsilon &)]

where epsilon is a small number that you can choose, and I assume your list elements are in the form {x,y,f}.

POSTED BY: Frank Iannarilli
Posted 8 years ago
POSTED BY: Rene Samson
Posted 8 years ago
POSTED BY: David Keith
Posted 8 years ago

Hi David,

This solves my problem indeed. You saved my day. Thanks a heap.

Two remarks, if I may: 1. I saw that both the list format {x1,x2, . . . y} as well as {{x1,x2, . . }, y} work in this case. (The Mathematica documentation recommends the latter format). 2. I would find it user-friendly if the Mathematica documentation for ListInterpolation would give am explicit referral to Interpolation for the case of non-grid lists. That would save other users a lot of heart ache.

Thanks so much for your advice, René

POSTED BY: Rene Samson
Posted 8 years ago

Hi Rene,

You want Interpolation rather than ListInterpolation. And notice that the argument is a list of {x1,x2, . . . y}.

d = RandomReal[{0, 10}, {1000, 3}];

f = Interpolation[d];

Interpolation::udeg: Interpolation on unstructured grids is currently only supported for InterpolationOrder->1 or InterpolationOrder->All. Order will be reduced to 1. >>

Plot3D[f[x, y], {x, 0, 10}, {y, 0, 10}]

InterpolatingFunction::dmval: Input value {0.000715,0.000715} lies outside the range of data in the interpolating function. Extrapolation will be used. >>

enter image description here

POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract