How do you write an expression when given a table of values?
I note that example problems of the kind "here's a table - what is the function?" can take various forms:
(1) The table contains two pairs of values and the expected answer is a linear function in the form
(2) The table contains more than two pairs of values, but still exactly linear, looking for a function of the form
(3) The table contains several pairs of exact values, with an expected answer being a simple polynomial function, an exponential function or some other simple function (e.g. sinusoid).
(4) The table contains approximate values (e.g. measurements from an experiment), from which one is expected to find a line or a simple function of best fit. The type of function may or may not be specified.
The different types of problem require different techniques, but here's a general solution for cases (1), (2) and polynomial examples of case (3)...
Given a table with distinct
Note that when
With this in mind, consider the polynomial:
#f(x) = ((x-x_2)(x-x_3)...(x-x_n))/((x_1-x_2)(x_1-x_3)...(x_1-x_n))y_1 + ((x-x_1)(x-x_3)...(x-x_n))/((x_2-x_1)(x_2-x_3)...(x_2-x_n))y_2 + ... + ((x-x_1)(x-x_2)...(x-x_(n-1)))/((x_n-x_1)(x_n-x_2)...(x_n-x_(n-1)))y_n#
This is a polynomial of degree at most
From this point you might want to multiply out the expressions to get the polynomial into standard form.
In practice, there are often simpler ways to get to a nice linear or polynomial function.