home


 * Lagrange Interpolation **

1. Definition
toc Lagrange interpolation is a well known, classical technique for interpolation. It is also called //Waring-Lagrange interpolation//, since //Edward Waring// actually published it 16 years before //Joseph Louis Lagrange//. More generically, the term polynomial interpolation normally refers to Lagrange interpolation.It is a simple and clever way of finding the unique Lth-order polynomial that exactly passes through L+1 distinct samples of a signal. Once the polynomial is known, its value can easily be interpolated at any point using the polynomial equation.

The advantage of Lagrange interpolation in comparison with the standard polynomial form or the Newton divided-difference representation is its simplicity. That is, the Lagrange interpolating polynomial can be determined without need of solving a system of simultaneous equations or performing repetitive calculations as in the case of Newton interpolating polynomials where a table of divided differences is required.

= =

[[image:LagrangeInterpolatingPoly_900.gif width="458" height="285" align="left"]]
An interpolation on two points, (x0, y0) and (x1, y1), results in a linear equation or a straight line. The standard form of a linear equation is given by y = mx + c, where m is the gradient of the line and c is the y-intercept. code m = y1 − y0 / x1 − x0 c = y0 − mx0 code which results in: code y = (y1 − y0 / x1 − x0) * x + (x1 y0 − x0 y1 )/ (x1 − x0) code The linear equation is rewritten so that the two interpolated points, (//x//0, //y//0) and (//x//1, //y//1), are directly represented. With this in mind, the linear equation is rewritten as: code P1(x) = a0(x − x1) + a1(x − x0) code where //a//0 and //a//1 are constants. The points //x//0 and //x//1 in the factors of the above equation are called the //centers//. Applying the equation at (//x//0, //y//0), we obtain: code y0 = a0(x0 − x1) + a1(x0 − x0)

or

a0 = y0/ x0−x1

code At (//x//1, //y//1), we get:

code y1 = a0(x1 − x1) + a1(x1 − x0), or a1 = y1/ x1−x0 code Therefore, the linear equation becomes: code P1(x) = y0 (x− x1) /(x0 − x1) + y1 (x− x0) / (x1 − x0) code The quadratic form of the Lagrange polynomial interpolates three points, (//x//0, //y//0), (//x//1, //y//1), and (//x//2, //y//2). The polynomial has the form: code P2(x) = a0(x− x1)(x− x2) + a1(x− x0) (x− x2) + a2(x− x0)(x− x1) code with centers at //x//0, //x//1, and //x//2. At (//x//0, //y//0): code y0 = a0(x0 − x1)(x0 − x2) + a1(x0 − x0)(x0 − x2) + a2(x0 − x0)(x0 − x1),

or

a0 = y0/ (x0 − x1)(x0 − x2) a1 = y1 / (x1 − x0)(x1 − x2) a2 = y2/ (x2 − x0)(x2 − x1) P2(x) = y0 (x− x1)(x− x2) / (x0 − x1)(x0 − x2) + y1 (x − x0)(x − x2)/ (x1 − x0)(x1 − x2) + y2 (x− x0)(x− x1)/ (x2 − x0)(x2 − x1) code In general, a Lagrange polynomial of degree //n// is a polynomial that is produced from an interpolation over a set of points, (//x////i//, //y////i// ) for //i// = 0, 1//,. . .,// //n//, as follows: code Pn(x) = y0L0(x) + y1L1(x) + ··· + ynLn(x) code

1.1 Demo
This demo implements interpolation of data points using parametric Lagrange polynomials. [|http://www.math.ucla.edu]

3.1 Voltage Regulator Circuit
Suppose you use a zener diode for a voltage regulator circuit (to filter out the small sinusoidal ripple voltage and to refine the constant power signal). You need to use the voltage - current characteristic I = I(V) in order to compute the steady-state voltage drop across the electric network. However, this function is not amenable to representation with a simple analytical expression. Instead, measurements are available only for several data points. Plotted on a graph "Voltage vs. Current", they look like this



How to connect the data values and to reproduce a simple analytical representation of the voltage - current characteristic? This is a problem of numerical interpolation: find a function I(V) that passes through each of the data points (Vk,Ik) for k = 0,1,2,...,n (total number of data values is n+1). We shall work only with polynomial interpolation, when the function I = I(V) is thought to be a polynomial. There are two principally different ways to construct the interpolating polynomial. One is to look for an uniform polynomial of a higher degree that passes through all given data points at once (see Lectures [|2.1] and [|2.2]). The other is to construct independent polynomials of lower degree on individual sub-intervals and to match them at the given data points (see [|Lecture 2.3]).

Given (n+1) data points, we shall look for a polynomial of degree n that has (n+1) undefined coefficients:

I(V) = a0 + a1 V + a2 V2 + a3 V3 + ... + + an-1 Vn + an Vn

The (n+1) coefficients must be matched with the (n+1) data values. There are two numerically accurate algorithms to find the same polynomial I(V) based on Lagrange and Newton interpolating polynomials. Both the methods use the following matching conditions:

I(Vk) = Ik, k=0,1,2,...,n,

that give (n+1) linear equations for (n+1) unknown coefficients of the interpolating polynomial. One can think about a straightforward method to solve the resulting linear system. However, the system is numerically ILL-conditioned and produces inaccurate numerical results. Instead of solving the linear problem, we follow to the Lagrange and Newton's methods to define the interpolating polynomials.

**3.2 Reconstruction of Compressed Digital Signal**
Lagrange's interpolation formula is a simple method for finding the unique polynomial of order N that exactly passes through N+1 distinct samples of a signal. Once the Lagrange polynomial is constructed, its value can easily be interpolated at any point using the polynomial equation. This implies, that a signal in interval [a,b] does need a large amount of data to interpolate, but only a constant number of points between them. The rest of the signal data will be reconstructed using Lagrange polynomial. Lagrange interpolation is useful in many applications, including Parks-McClellan FIR Filter Design,IIR Filter Design, Adaptive Filters [10]. The Discrete Fourier Transformation also with Fast Fourier Transformation and Practical Spectral Analysis Lagrange's interpolation method is a simple and efficient way of finding the unique LLth-order polynomial that exactly passes through L+1 distinct samples of a signal. Lagrange interpolation polynomials could be used to obtain good gradient estimations. As an error criterion one should take the mean squared error. It could be pointed that squared error converges to N-1 if the number of evaluation points increases to infinity. In real application one should use finite number of points to define good signal approximation.
 * Algorithm **

 In this section a key algorithm will be briefly present, coded in //Pascal// (//Delphi for Windows//) that is the core of the Lagrange application [11]. The next listing generates digital representation of the signal based on samples:

function fx_lagrange(x:real):real; var suma,pro:real; i,j,f:integer; begin suma:=0;

for i:=1 to lnum do begin pro:=1;

for j:=1 to lnum do if (i<>j) then

pro:=pro* (x-l[j].x) / (l[i].x-l[j].x);

suma:=suma+ l[i].y*pro; end;

fx_lagrange:=suma; end;

This procedure is based on formulas (3) and (4). Variable //LNUM// is the number of interpolation points. The procedure gives the y value based on Lagrange calculation on the input x coordinate. The procedure is very fast because it contains only fast arithmetic operations, without trigonometry ones. This is very suitable for the real time application.

**3.3 Windows Application**
Vladan Vučković has developed the application //Lagrange for// //Windows// (Fig. 3) in order to perform experiments with different sets of Lagrange interpolation in mathematical or real domain (signals). This application is very useful for developing of the Lagrange interpolation based algorithms. Using the results from different experiments, the author developed a set of supporting interpolation algorithms that could efficiently reconstruct signals from its compressed forms.



Some basic functions of the applications are: • Automatic generation of mathematical functions, loading real signals and approximations using Lagrange interpolation. • Automatically calculation of middle-square error. • Automatically generation of root points, their values, and approximation functions. • Different types of visualization of function. The application enables different kind of experiments with real or mathematically generated functions. The digitalized signals could be inserted, processed and compressed with this application. Also, it could help in researching of the signal reconstruction from the low sample rate digitalized signal.

**3.4 Curve Fitting**
 Polynomials are fit to data points in both regression and interpolation. In regression, a large number of data points is fit with a function, usually a line: y=mx+b. The equation may have more than one "x" (more than one dependent variable), which is called multiple linear regression.

 In interpolation, short polynomials are joined together so they pass through all the data points. For those who are curious to research this more, the name of some of the polynomials used for interpolation are called "Lagrange polynomials," "cubic splines" and "Bezier splines."

**Other proposed application for Lagrange Interpolating Polynomial** 
 * Image vector quantization codec indices
 * Skeletal muscle fatigue analysis
 * An efficient SFE method: Application to nonlinear mechanical problems with uncertain parameters

4. References
[] [] [|http://www.math.ucla.edu/~baker/java/hoefer/Lagrange.htm] [|http://pegasus.cc.ucf.edu/~klee/EGN3420/Notes/Interp_Lagrange.pdf] []