Message Boards Message Boards

1
|
13350 Views
|
7 Replies
|
11 Total Likes
View groups...
Share
Share this post:

Interpolation, unstructured grids, and interpolation order

Posted 11 years ago
Hello
Interpolation throws an error (Interpolation::udeg: Interpolation on unstructured grids is currently only supported for InterpolationOrder->1 or InterpolationOrder->All. Order will be reduced to 1.) when called on an unstructured grid.   However, I get either nothing or an error when I try the suggested interpolation orders.  Am I doing something wrong, or is this a bug?

Example data for interpolationGrid is given at the end of the post.
Works:
interp = Interpolation[interpolationGrid] (*works just fine*)
interp[0.5, 1.5]

Throws error
rinterp = Interpolation[Reverse /@ interpolationGrid] (*throws the Interpolation::udeg:  error*)

Interpolation does not throw an error, but returns an InterpolatingFunction that looks right but throws an error when used
rinterp  = Interpolation[Reverse /@ interpolationGrid, InterpolationOrder -> All]
rinterp[-10, -50] (* throws Thread::tdlen: Objects of unequal length *)


Interpolation does not throw an error, but doesn't return a valid InterpolatingFunction:rinterp =
rinterp =Interpolation[Reverse /@ interpolationGrid, InterpolationOrder -> 1]


Example data:
interpolationGrid={{{0, 0}, {-46.469, -52.2776}}, {{0, 1}, {-42.9885, -37.615}}, {{0,
   2}, {-39.5618, -24.7261}}, {{0, 3}, {-35.8436, -13.4413}}, {{1,
   0}, {-41.014, -61.5209}}, {{1, 1}, {-38.638, -45.0776}}, {{1,
   2}, {-35.7402, -29.7835}}, {{1, 3}, {-32.0293, -16.0146}}, {{2,
   0}, {-31.049, -69.8602}}, {{2, 1}, {-29.9241, -52.3672}}, {{2,
   2}, {-28.4003, -35.5004}}, {{2, 3}, {-25.9637, -19.4728}}, {{3,
   0}, {-16.8131, -75.6591}}, {{3, 1}, {-16.5981, -58.0934}}, {{3,
   2}, {-16.3716, -40.929}}, {{3, 3}, {-15.9872, -23.9808}}}
POSTED BY: W. Craig Carter
7 Replies
When interpolating on an unstructured grid, the function values can only be real or complex numbers.
Furthermore, only machine precision is supported and any data will be coerced to machine precision.
POSTED BY: Ilian Gachevski
Thanks!  This works just fine:
rinterp =
Interpolation[{First[#], First[Last[#]]} & /@
   Reverse /@ interpolationGrid, InterpolationOrder -> All]
POSTED BY: W. Craig Carter
Posted 2 years ago

If the unstructured grid is not too large ResourceFunction@"PolyharmonicSplineInterpolation" works great.

POSTED BY: Ted Ersek
Posted 3 months ago

Thanks for the information. But the documentation (Mathematica 12.2) says "The Subscript[f, i] can be lists or arrays of any dimension."

This item was 10 years old. Does Wolfram have a problems list? Is this on the list?

POSTED BY: David Golber

Sorry, but I don't understand how The Subscript[f, i] pertains to this question.

Can you elaborate?

Which page of the Docs are you looking at?

POSTED BY: W. Craig Carter
Posted 3 months ago

I'm just reading the documentation for Interpolation (Mathematica 12.2). What comes up when I'm in Mathematica, click "Help", type "Interpolation", etc.

POSTED BY: David Golber

Perhaps David Golber is referring to this issue:

One-dimensional codomain: WORKS

grid = RandomReal[10, {20, 2}];
fi = RandomVariate[NormalDistribution[], {20}];
ifun = Interpolation[Thread[{grid, fi}], InterpolationOrder -> 1]

One-dimensional domain: WORKS

grid = RandomReal[10, {20}];
fi = RandomVariate[NormalDistribution[], {20, 3}];
ifun = Interpolation[Thread[{grid, fi}], InterpolationOrder -> 1]

Many-dimensional domain and codomain: FAILS

grid = RandomReal[10, {20, 2}];
fi = RandomVariate[NormalDistribution[], {20, 3}];
ifun = Interpolation[Thread[{grid, fi}], InterpolationOrder -> 1]

BEWARE: I tried the last one multiple times, and once it cause the kernel to crash. (And only once, so far.)

POSTED BY: Michael Rogers
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