0
$\begingroup$

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?

$\endgroup$
  • 2
    $\begingroup$ 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. $\endgroup$ – ercegovac Sep 30 '17 at 11:26
  • $\begingroup$ The points are not "poised," so there is no polynomial interpolation of the data. (Try InterpolatingPolynomial[data, {x, y}].) $\endgroup$ – Michael E2 Sep 30 '17 at 15:19
2
$\begingroup$

Does this answer your question?

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]

enter image description here

$\endgroup$
  • $\begingroup$ Can I obtain a closed formula which can for example tell me the value of function at point $(4,5)$? $\endgroup$ – A. Mpi Sep 30 '17 at 11:47
  • $\begingroup$ @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. $\endgroup$ – ercegovac Sep 30 '17 at 12:13
  • $\begingroup$ tanx. ifun[4,5] gives an answer but it's not true. $\endgroup$ – A. Mpi Sep 30 '17 at 12:37
  • 1
    $\begingroup$ 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. $\endgroup$ – ercegovac Sep 30 '17 at 12:43
  • 1
    $\begingroup$ @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. $\endgroup$ – J. M. will be back soon Sep 30 '17 at 14:35

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.