We need to determine the specific volume of Freon-12 vapor
under a pressure of $\color{var(--emphColor)}{400}kPa$, using the following data:
\begin{array}{c|c|c|c|c}
\text{Pressure }(kPa)&308.6 & 362.6 & 423.3 &491.4\\
\hline
\text{Specific volume }(m^3/ kg)& 0.055389 & 0.047485 & 0.040914 & 0.035413
\end{array}
We need to construct the cubic polynomial interpolant $f$
and then evaluate $f(\color{var(--emphColor)}{400})$.
The interpolant is a linear combination of the Lagrange basis polynomials $L_j$, so
$$f(x) = 0.055389 L_0(x) + 0.047485 L_1(x) + 0.040914 L_2(x) + 0.035413 L_3(x).$$
Great in theory
The Lagrange basis polynomials are very useful in developing
and proving theory.
If $x_0,x_1,\ldots, x_n$ are $n+1$ distinct
abscissas and $y_i = f(x_i)$ denotes the value of
a continuous function $f$ at $x = x_i$,
then there is a unique
polynomial $p$ of degree at most $n$
$p$ such that $p(x_i) = y_i, i=0,1,\ldots, n$.
If $x_0,x_1,\ldots, x_n$ are $n+1$ distinct
abscissas and $y_i = f(x_i)$ denotes the value of
a continuous function $f$ at $x = x_i$,
then there is a unique
polynomial $p$ of degree at most $n$
$p$ such that $p(x_i) = y_i, i=0,1,\ldots, n$.
The Lagrange basis gives the “existence”
part for free, since
we know that if
$$p(x) = \sum_{i=0}^n y_i L_i(x),$$
then $p(x_i) = y_i.$
If $x_0,x_1,\ldots, x_n$ are $n+1$ distinct
abscissas and $y_i = f(x_i)$ denotes the value of
a continuous function $f$ at $x = x_i$,
then there is a unique
polynomial $p$ of degree at most $n$
$p$ such that $p(x_i) = y_i, i=0,1,\ldots, n$.
(Continued.)
Suppose there is another interpolating polynomial $q$ of degree
at most $n$. Let $d(x) = q(x) - p(x)$ and note that $d$ is a
polynomial of degree at most $\color{var(--emphColor)}{n}$, since it is a difference
of two such polynomials.
Since $p$ and $q$ both interpolate the data, $d$ has
$\bbox[3pt, border: 3pt solid var(--emphColor)]{n + 1}$ roots:
$$d(x_i) = p(x_i) - q(x_i) = 0.$$
Great in theory, but...
In practice, naively constructing and evaluating the Lagrange
basis polynomials
could lead to large roundoff errors.
The naive evaluation is also costly and hard to update
in the presence of new data points.
In the next module we'll expand on these shortcomings and
discuss how to overcome them.
Congratulations! You reached the end of this lecture.