[Math] Algebraically Deriving a function from a Table of Values

functions

Is there an algebraic solution to deriving a function from a table of values, for example:
\begin{array} {|r|r|}
\hline
x &f(x) \\
\hline
1 &2 \\
\hline
2 &4 \\
\hline
\end{array}

which produces $f(x)=2x$

\begin{array} {|r|r|}
\hline
x &f(x) \\
\hline
1 &1 \\
\hline
2 &4 \\
\hline
3 &9 \\
\hline
\end{array}

which produces $f(x)=x^2$

How can this be derived algebraically? And what will result if you are given a table of values that does not represent a function? Is it possible to find a table of values that is similar that will result in a function?

Context: I'm writing software that interprets an image and finds it's outline, then converts the outline to a set of polynomials that when drawn, create an outline similar within a degree of the original images outline

Best Answer

There is, if you restrict yourself to for example "polynomials of degree $n$". Given how broad the function concept is, it is easy to see how ill-posed your question is. Just consider the class of functions $f(x) = 2$ for $x=1$, $f(x) = 4$ for $x=2$, $f(x) = y(x)$ for every other $x$. Every conceivable function $y(x)$ constructs an $f(x)$ that fulfils your criteria!

Even if you restrict yourself to continuous functions, there is in general infinitely many functional solutions to your constraints. In genereal however, for $n+1$ data points, a $n$ degree polynomial that interpolates the data points is uniquely given.

Related Question