How to interpolate between points so that the interpolation function is injective and smooth

interpolationnumerical methods

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.

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.

Related Question