Polynomial interpolation but with a perfect fit on certain data points

39 Views Asked by At

When given $n$ data points $(x_1,y_1),\ldots, (x_n,y_n)$ (where $x_i\neq x_j$ for $i\neq j$) we can use the least squares method to obtain a polynomial $f$ of degree $m$ (with $m<n$) such that the sum of squared errors is minimized. It is known that in general we only have $f(x_i)\approx y_i$ instead of equality. Is there some way to modify the least squares method (or any other approximation technique) to fit certain data points, say for example the first and final data point, perfectly, that is $f(x_1)=y_1$ and $f(x_n)=y_n$, while still minimizing the squared sum of the remaining errors?

1

There are 1 best solutions below

0
On

Given a $N$ degree fitting polynomial $P_N(x)=\sum_k a_k x^k$ and a data set $D=\{x_j,y_j\},\ \ \ j=1,\cdots,M$ we can solve

$$ \min_{a_k}\sum_{j=2}^{M-1}\left(\sum_{k=0}^N a_k x_j^k-y_j\right)^2\ \ \ \text{s. t.}\ \ \sum_{k=0}^N a_k x_{\nu}^k-y_{\nu} = 0,\ \ \nu = \{1,M\} $$

This is can be solved by using the Lagrange multipliers technique.