Function Interpolation and Approximation
Let say that the temperature at the noon is 14^{0}C and two hours later it increase to 16^{0}C. What is the temperature at 1 pm.? Of course, we can't know exactly what was the temperature at 1p.m. based on these two values but we are rather sure that it was somewhat between.
In many situation, in science and engineering and other areas we need a concrete figure as the answer to the question like above one. Among many possible ways of the temperature change from noon to 2 pm., we can assume the one for which the temperature at 1 pm. was 15^{0}C. This is easy to calculate (the value is the mean of the two values since 1 pm is in the middle of the given period) and the most probably close to the real value.
The method we just describe on this simple example is called linear interpolation. Among the interpolation methods linear interpolation is conceptually the simplest and it is often used.
Two basic method of function interpolation are interpolations by
 Lagrange polynomial and
 Newton polynomial.
In this article we will describe, explain and illustrate both of techniques. One can find a concrete case study that compare the two procedure on the same data (see Example 1 and Example 2).
Function Interpolation
In many occasions we don't know analytical expression of some function f but only its values in several points: x_{0}<x_{1}<x_{2}<...<x_{n}. Situations like these demand to calculate i.e. to estimate the function value in some points different than the given ones – for which we know the value of function. A procedure of determination of function g on the interval [x_{0},x_{n}] where it holds
g(x_{i})=f(x_{i}), i=0,1,2,...
is called function interpolation.
A function g can be chose from the class of polynomials, trigonometric, rational and other function. Probable the most common is polynomial interpolation (i.e. linear and polynomial since a polynomial of the degree two we call linear function).
Close to the term function interpolation is approximation of a function. The main difference is that within interpolation we are looking for "a missing value" between the two known function values while within approximation we are looking for a simpler function replacing a complex one (which is either known or unknown). While obtained function within interpolation have to contain all already known values it is not case in approximation. In that case obtain function have to fit known values "as best as possible" – the criterion for this adhesion is usually defined by the minimum squares method. Function approximation will be explained later in this article.
Interpolation by Lagrange Polynomial
Now, polynomial interpolation will be exposed by means of two methods i.e. using the Lagrange polynomial and Newton polynomial.
Let the pair of points (x_{0},f(x_{0})), (x_{1},f(x_{1})),...,(x_{n},f(x_{n})) are given, representing known values of a function. The general expression of Lagrange polynomial then is
For Lagrange polynomials of the degrees one and two it holds:
Example 1. What is the Lagrange polynomial which graph contains the points T_{0}(2,3), T_{1}(0,1) and T_{2}(1,6).
Since we have three function value known, polynomial of the degree two will be chosen. Lagrange polynomial of the degree two is presented on the figure above. Substituting the values we get:
Thus, the solution is polynomial 2x^{2}+5x1 which graph is presented on the first figure. It is visible that the graph contain all three given points.
Interpolation by Newton Polynomial
The general expression of Newton polynomial is given by
where
As an illustration, it follows Newton polynomials of the degrees one and two.
Calculation of the coefficients in Newton polynomial is practical if one use this differences table:
Contrary to Lagrange method, here one can additionally add a new pair of points (adding one sequence in the table). Furthermore, if some of data changes it is not necessary to count all over again but only the related differences.
The next example illustrates the method on the same case as we have in the first example.
Example 2. For the points T_{0}(2,3), T_{1}(0,1) and T_{2}(1,6) find interpolation polynomial by means of Newton's method.
Firstly, the table of differences should be determined:
x0=2
 f[x0]=3
 
f[x0,x1]=(1+3)/2=1
 
x1=0
 f[x1]=1
 f[x0,x1,x2]=(7+1)/(1+2)=2
 
f[x1,x2]=/6+1)/1=7
 
x2=1
 f[x2]=6

As a second and final step, coefficients obtained by the table above we substitute in the Newton polynomial of the degree two. As we expected, the solution is the same as in case when Lagrange method were used.
Function Approximation
In the above we dealt with function interpolation, which means that that function f is replaced by a function g so that its value are equal in the given points.
Here we should to replace a function f with some more simple function that will “very well present f on the whole domain. The “quality” of the approximation will be measured by minimum sum squares method. More precisely, a function g have to be determined, with the following condition, where n is the number of known function value:
Linear Function Approximation
Let pairs (x_{1},y_{1}), (x_{2},y_{2}),...,(x_{n},y_{n}) represent n known values of the function f. The equations of linear function which approximate the given set my means of minimum sum squares method is
where we have the mean of both x and y values and where it holds
x
 y
 (xx_av)^2
 (xx_av)(yy_av)


0.0
 0.06
 2.29
 2.19

0.2
 0.30
 1.72
 1.58

0.6
 0.48
 0.83
 0.94

1.0
 1.15
 0.26
 0.18

1.2
 1.36
 0.09
 0.04

1.9
 1.72
 0.14
 0.08

2.0
 2.10
 0.23
 0.28

2.1
 2.25
 0.34
 0.43

2.9
 2.80
 1.91
 1.78

3.0
 2.88
 2.20
 2.03

x_av
 y_av
 s_x^2
 s_xy

1.49
 1.51
 1.00
 0.95

Example 3. Given the set of points as in the table below, we have to find linear function by means of minimum squares method.
The whole calculation can be seen in the next table. Once we substitute the obtained values (the last row in the table) in the general linear function equation above, final solution follows: g(x)=0.951192*x+0.092724.
The obtained function g and previously given data one can see in the next figure.
A video at the end shows how we can use function interpolation in order to find a missing data. In this example we use the simplest possible case linear interpolation. Although linear interpolation is the simplest type of interpolation it is suitable in most of the situations.
Simple Function Interpolation
Three excellent books on function interpolation and approximation from Amazon
Comments
No comments yet.