# Two-variable interpolation

I have the following data:

$(2,2) \rightarrow 3$

$(2,3) \rightarrow 3$

$(2,4) \rightarrow 6$

$(2,5) \rightarrow 6$

$(2,6) \rightarrow 10$

$(2,7) \rightarrow 9$

$(2,8) \rightarrow 15$

$(2,9) \rightarrow 14$

$(3,3) \rightarrow 7$

$(3,4) \rightarrow 16$

$(3,5) \rightarrow 30$

$(4,4) \rightarrow 53$.

How can I find an interpolating two-varaiable polynomial or function for these datas?

• Did you try Interpolation? More specifically the form Interpolation[{{{x1,y1},f(x1,y1)},{{x2,y2},f(x2,y2)},...}]. You can specify the order, type of interpolation and other parameters. Commented Sep 30, 2017 at 11:26
• The points are not "poised," so there is no polynomial interpolation of the data. (Try InterpolatingPolynomial[data, {x, y}].) Commented Sep 30, 2017 at 15:19

data = {{{2, 2}, 3}, {{2, 3}, 3}, {{2, 4}, 6}, {{2, 5}, 6}, {{2, 6}, 10}, {{2, 7}, 9}, {{2, 8}, 15}, {{2, 9}, 14}, {{3, 3}, 7}, {{3, 4}, 16}, {{3, 5}, 30}, {{4, 4}, 53}}
ifun = Interpolation[N@data, InterpolationOrder -> 1]


We can plot it using

ContourPlot[ifun[x, y], {x, 2, 4}, {y, 2, 9}, PlotLegends -> Automatic]


• Can I obtain a closed formula which can for example tell me the value of function at point $(4,5)$? Commented Sep 30, 2017 at 11:47
• @A.Mpi Just evaluate ifun[4,5] and it will give you the value. However, it will also throw you a warning that you are outside of the range of the data provided. As you can see, the data is plotted for that region as well. Commented Sep 30, 2017 at 12:13
• tanx. ifun[4,5] gives an answer but it's not true. Commented Sep 30, 2017 at 12:37
• Well, as I said the specified point lies outside of the region of the data provided. Thus, you will have to extrapolate data to that region, which brings us to what extrapolating function you want to use. That goes beyond your original question. Evaluation on my machine gives a 52 which is i.m.o. reasonable. Commented Sep 30, 2017 at 12:43
• @A. Mpi, it is unreasonable to expect any interpolation to perform well when given an input that is outside the domain of the original data. Commented Sep 30, 2017 at 14:35