How do I interpolate between points so that the interpolation function is injective and smooth?

252 Views Asked by At

I have a set of $n$ points, $\left\{ \left(x_i,y_i\right) \right\}$, where for all $i$ (except for $1$ and $n$), $x_{i-1} < x_i < x_{i+1}$ and $y_{i-1} < y_i < y_{i+1}$.

What I want to do is to construct a function $f:[x_1, x_n]\mapsto [y_1, y_n]$ that

  1. satisfies $f(x_i)=y_i$ for all $i$
  2. is injective
  3. is at least twice differentiable (but ideally more).

Linear interpolation is not differentiable. Lagrange polynomial or spline interpolation cannot be guaranteed they are injective (usually not). I found one question in this site but I am not sure if this is what I want, given that it is not an interpolation, while mine does not necessarily require it to be a single polynomial over the domain ( Polynomial fitting where polynomial must be monotonically increasing ).

Is there a way to make an interpolation function that is guaranteed to be injective and smooth?

Edit: Thanks to QiaochuYuan's comment, I add another detail. I want this function to have a minimal number of inflexion points. With the worst possible data, it would have $n-3$ inflexion points (as lonza leggiera pointed out). So I guess a "good" interpolation should have inflexion points no more than $n-3$, or whatever the minimum number of points that data can allow, while being twice differntiable. Specifically, the problem I concern right now only involves 5 points, and it seems possible to have only 1 inflexion point for the given data.

2

There are 2 best solutions below

0
On BEST ANSWER

Doesn’t monotone spline interpolation do what you want? There are many variations available, but you can start reading about a simple approach here.

1
On

$\def\eqdef{\stackrel{\text{def}}{=}}$ Not an answer, but a couple of observations that are too long for comments.

  • If $\ f\ $ is twice continuously differentiable then it can be forced by your data to have at least $\ n-3\ $ inflection points. By the mean value theorem, for each $\ i=1,2,\dots,n-1\ $ there must exist $\ \xi_i\in\big(x_i,x_{i+1}\big)\ $ such that $$ f'(\xi_i)=\frac{y_{i+1}-y_i}{x_{i+1}-x_i}\ , $$ and then for each $\ i=1,2,\dots,n-2\ $, there must exist $\ \zeta_i\in\big(\xi_i,\xi_{i+1}\big)\ $ such that \begin{align} f''(\zeta_i)&=\frac{f'(\xi_{i+1})-f'(\xi_i)}{\xi_{i+1}-\xi_i}\\ &=\frac{\frac{y_{i+2}-y_{i+1}}{x_{i+2}-x_{i+1}}-\frac{y_{i+1}-y_i}{x_{i+1}-x_i}}{\xi_{i+1}-\xi_i}\ . \end{align} Since $\ \xi_{i+1}>\xi_i\ $, the sign of $\ f''(\zeta_i)\ $ is the same as that of $\ s_i\eqdef\frac{y_{i+2}-y_{i+1}}{x_{i+2}-x_{i+1}}-\frac{y_{i+1}-y_i}{x_{i+1}-x_i}\ $ and so if $\ s_i\ $ and $\ s_{i+1}\ $ are of opposite signs then there must be a point of inflection of $\ f\ $ lying between $\ \zeta_i\ $ and $\ \zeta_{i+1}\ $. Therefore, the number of points of inflection that $\ f\ $ will be forced to have is the number of sign changes in the sequence $\ s_1,s_2,\dots,s_{n-2}\ $, which will be $\ n-3\ $ if the signs of $\ s_i\ $ alternate. For $\ n=5\ $, therefore, it's possible that $\ f\ $ could be forced to have at least two inflection points.
  • Apart from the the fact that you might not be able to have as few inflection points as you might have wanted, I'm certain that you can achieve the rest of the properties you have specified with spline interpolation. I suspect they're achievable with a cubic spline, but if that's true, the proof doesn't appear to be easy.