# Create a function based on a table of values.

Alright, so I have this table of data.

I want to find the function to calculate the remaining fields marked with a "?" using the constant on the left.

I am assuming (just by looking at these values in a graph) that the function I need is an exponential function.

Now my question is, how would I approach finding the right function for this? I've tried several things the past few days but I just can't get my head around it.

I don't want the full solution, but I'd love to get some kind of kickstart in the right direction.

• Functions in 2 variables can be bothersome to compute/guess unless you have some background on the problem. – prog_SAHIL Jan 12 '18 at 9:41

For such kind of problems you may make some experiments using WolframAlpha.
A 'bestfit' for the first line is not very satisfying but considering the reciprocals gives you this.
Even a linear interpolation seems good enough and suggests that $f(1,70)$ could be near $\,90$ !

The first and second line are nearly generated by \begin{align} f(x,70)&\approx\dfrac 1{0.0131215 - 0.00203371 \,x}\\ f(x,100)&\approx\dfrac 1{0.00879286 - 0.00140815 \,x}\\ \end{align}

Your next problem is to find a fit between the values $70, 100$ and the coefficients at the right. Observe that $\,\dfrac{0.00203371}{0.00140815}$ is not too far from $\,\dfrac{100}{70}\,$ and that the ratio of coefficients in the two denominators are near.

We may thus propose the (very) rough approximation : $$f(x,y)\approx \frac y{0.9-0.141\,x}$$

To get something more precise we may minimize the sum of the squares of the differences between $f_{rat}(x,y)=\dfrac{ay}{1-bx-cy}\;$ and the values in your table (I used simulated annealing for that purpose, many other optimization algorithms exist). I obtained : $$f_{rat}(x,y)\approx \frac{1.08386\;y}{1- 0.1449\,x -0.0008513\,y}$$ These approximations will become singular for $x$ a little larger than $6$.
Let's try your exponential suggestion with $\exp(a+b\,x+c\,y)$ but the resulting : $$f_{exp}(x,y)\approx \exp(-1.59+1.129\,x+0.02575\,y)$$ is increasing too fast so let's combine rational and exponential to get : $$f_{mix}(x,y)\approx \frac{\exp(3.2177+0.0248\,x+0.01397\,y)}{1-0.145777\,x-0.0007615\,y}$$

\begin{array} {c|cccc|cccc} x&f(x,70)&f_{rat}(x,70)&f_{exp}(x,70)&f_{mix}(x,70)&f(x,100)&f_{rat}(x,100)&f_{exp}(x,100)&f_{mix}(x,100)\\ \hline 1&?&95.37&3.8&85.0&135&140.8&8.3&133.0\\ 2&111&116.6&11.8&106.5&167&173.4&25.6&167.8\\ 3&142&150.0&36.6&140.4&219&225.7&79.2&223.5\\ 4&200&210.3&113.3&201.6&321&212.3&244.9&327,2\\ 5&342&351.4&349.8&345.0&592&569.3&757.5&586.2\\ 6&1070&1068.5&1081.9&1069.6&2382&2383.7&2342.6&2381.8\\ \end{array}

Extrapolating a third line from only two lines doesn't make much sense without knowledge of the process involved. Anyway for the fun here are the results with the three functions :

\begin{array} {c|ccc} x&f_{rat}(x,170)&f_{exp}(x,170)&f_{mix}(x,170)\\ \hline 1&259.4&50.2&379.7\\ 2&325.8&155.3&487.2\\ 3&438.1&480.3&667.5\\ 4&668.4&1485.5&1031.3\\ 5&1408.9&4594.0&2145.1\\ 6&-13048&14207&-75662\\ \end{array}