Consider the following sample code

Interpolation[{Range[20], 2*Range[20]}];

Interpolation::indim: The coordinates do not lie on a structured tensor product grid. >>

which should not work because of the error explained in the warning message. For larger vectors (of length greater or equal to 66) result is completely different

With[{n = 66}, Interpolation[{Range[n], 2*Range[n]}]]

SystemException["InterpolationLimit", {65, 1}]

without warning message. Is this bug reproducible on newer versions of Mathematica or on other systems (I'm working on version 10.0 under OSX), and what may be a reason of that? (Corrected code, e.g. With[{n = 66}, Interpolation[{{0,Range[n]}, {1,2*Range[n]}}]] works with any nonnegative n.)


The error is due to an old Interpolation syntax for specifying multidimensional data as

$$\{\{x_1, y_1, z_1, \ldots, f_1\}, \{x_2, y_2, z_2,\ldots, f_2\}, \ldots \}$$ meaning that $f_i$ is the desired function value at the point $\{x_i, y_i, z_i, \ldots \}$ where the points lie on a structured tensor product grid.

This syntax was deprecated a long time ago, but is still accepted for backward compatibility (see also the legacy reference page). For example,

data = Flatten[Table[{x, y, z, t, Times[x, y, z, t]}, {x, 4}, {y, 4}, {z, 4}, {t, 4}], 3];
if = Interpolation[data];
if[4, 4, 4, 4]

(* 256 *)

The input from the question requests a function that takes the value $66$ at the point $\{1, 2, 3, \ldots, 65\}$ and $132$ at the point $\{2, 4, 6, \ldots, 130\}$. Getting a SystemException is not unreasonable, since interpolating in 65 or more dimensions is somewhat extreme.

  • $\begingroup$ Thank you for explanation. What do you mean by 'is still accepted'? The Interpolation[{{x1, y1, z1, ..., f1}, ...}] doesn't work but just returns its input. $\endgroup$ – mmal Oct 29 '15 at 8:26
  • $\begingroup$ @mmal That it still works as it used to. Answer updated for clarity. $\endgroup$ – ilian Oct 29 '15 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.