2.3
Polynomial interpolation: Calculation according to Lagrange
We consider the following polynomials of degree \(n\):
| | \begin{equation*} \begin{split} \hat{L}_0(x)
&= (x-x_1)(x-x_2)\cdots(x-x_n) \qquad (\hat{L}_0(x_0)\neq 0; \hat{L}_0(x_k)=0 \text{ for } k\neq0), \\ \rule{0mm}{0.9em}
\hat{L}_1(x) &= (x-x_0)(x-x_2)(x-x_3)\cdots(x-x_n) \qquad (\hat{L}_1(x_1)\neq 0; \hat{L}_1(x_k)=0 \text{ for } k\neq1),
\\ & \ \, \vdots\\ \hat{L}_n(x) &= (x-x_0)(x-x_1)(x-x_2)\cdots(x-x_{n-1}) \qquad (\hat{L}_n(x_n)\neq 0; \hat{L}_n(x_k)=0
\text{ for } k\neq n). \end{split} \end{equation*} | (2.1) |
Short definition: \(\hat{L}_k(x)=\prod^n_{j=0,\,\,j\neq k} (x-x_j)\). Next, we normalize the polynomials \(\hat{L}_k(x)\) by division through \(\hat{L}_k(x_k)\):
| | \begin{equation*} L_k(x) = \frac{\hat{L}_k(x)}{\hat{L}_k(x_k)}\,.
\end{equation*} | (2.2) |
\(L_k(x)\) is a polynomial of degree \(n\), \(L_k(x_j)=0\) for \(j\neq k\),
\(L_k(x_k)=1\) (normalization). It can be written as
| | \begin{equation*} L_k(x) = \prod^n_{j=0,\,\,j\neq
k}\frac{x-x_j}{x_k-x_j}\,. \end{equation*} | (2.3) |
Definition:
Lagrange polynomials
The polynomials
\(L_k(x)=\prod^n_{j=0,\,\,j\neq k} \frac{x-x_j}{x_k-x_j}\) are called Lagrange polynomials.
Since \(L_k(x_k) = 1\) for all \(k\in\{0,1,2,\dots,n\}\), a polynom interpolating all data points
\((x_0,y_0), (x_1,y_1),\dots,(x_n,y_n)\) is obtained by
| | \begin{equation*} p(x)=y_0 L_0(x)+y_1
L_1(x)+y_2 L_2(x)+\dots+y_n L_n(x)=\sum\limits_{j=0}^n y_jL_j(x)\,. \end{equation*} | (2.4) |
This can be easily seen by evaluating \(p(x_k)\) for arbitrary \(k\).
The use of Lagrange polynomials is expedient if one has a fixed set of supporting points \(x_0, x_1, \ldots
, x_n\) and several sets of \(y\) data for these supporting points. Once the Lagrange polynomials are calculated,
the desired function \(p(x)\) can be found rather easily.
Example:
Consider again the following points: \((x_0,y_0)
= (0,1)\); \((x_1,y_1) = (1,6)\); \((x_2,y_2) = (2,15)\). The corresponding Lagrange polynomials
are:
| | \begin{equation*} \begin{split} L_0(x)&=\displaystyle\frac{(x-x_1)(x-x_2)}{(x_0-x_1)(x_0-x_2)}=\frac{(x-1)(x-2)}{(0-1)(0-2)}=\frac{1}{2}(x-1)(x-2)\,,
\\ \rule{0mm}{1.3em} L_1(x)&=\displaystyle\frac{(x-x_0)(x-x_2)}{(x_1-x_0)(x_1-x_2)}=\frac{(x-0)(x-2)}{(1-0)(1-2)}=-x(x-2)\,,
\\ \rule{0mm}{1.3em} L_2(x)&=\displaystyle\frac{(x-x_0)(x-x_1)}{(x_2-x_0)(x_2-x_1)}=\frac{(x-0)(x-1)}{(2-0)(2-1)}=\frac{1}{2}x(x-1)\,.
\end{split} \end{equation*} | (2.5) |
With that, one obtains
| | \begin{equation*} \begin{split} p(x)&=y_0L_0(x)+y_1L_1(x)+y_2L_2(x)\\
\rule{0mm}{0.8em} &=1\times\textstyle\frac{1}{2}(x-1)(x-2)+6\times(-x)(x-2)+15\times\frac{1}{2}x(x-1)\\ \rule{0mm}{0.8em}
&=\textstyle\frac{1}{2}(x^2-3x+2)-6(x^2-2x)+\frac{15}{2}(x^2-x)\\ \rule{0mm}{0.8em} &=1+3x+2x^2. \end{split} \end{equation*} | (2.6) |
© J. Carstensen (Comp. Math.)