Let $A$ be a finite (and small-ish) set of positive real numbers and 0. Let $B$ be a subset of $\mathbb N^0$, up to some (small-ish) bound.

I have a function $f(t)$, $A \rightarrow B$ that is strictly monotonically increasing. It is $f(0) = 0$ and $f$ shall cover all values of its codomain $B$.

In plain English: $f$ starts at (0,0) and always increases by one, but with varying $\Delta t$ in between the steps.

A simple continuous version of $f(t)$ is $c(t)$ which I can get by piecewise linear interpolation. However since my $\Delta t$ values are all different, the derivative $c'(t) = dc/dt$ will have discontinuities.

I am looking for the easiest possible function $g(t)$ (stretching and squeezing $t$) such that $\frac {dc(g(t))}{dt}$ is smooth, with $g(t)=t$ $\forall t \in A$.

In plain English: How can I turn my simple linear interpolation into something that has a continuous time derivative (but still perfectly interpolates $f$)?

  • $\begingroup$ Can your question be boiled down to this: you have a sequence $(0,a_1,a_2,\dots,a_n)$, and you want a smooth monotonic function $h:[0,a_n]\to\{0,1,\dots,n\}$ such that $h(a_i)=i$ for all $i$? Why does it have to be of the form $h=c\circ g$? $\endgroup$ – user3883 Jul 1 '18 at 5:34
  • $\begingroup$ If it is sufficient for $h$ to be $C^1$ and not $C^\infty$, you could try Fritsch & Carlson's monotone piecewise cubic interpolation. $\endgroup$ – user3883 Jul 1 '18 at 5:35
  • $\begingroup$ @Rahul yes, sorry, it should be $f:A \rightarrow B$. I just fixed it. $\endgroup$ – rsp1984 Jul 1 '18 at 14:03
  • $\begingroup$ @Rahul The codomain of $c(t)$ is no longer $B$ but rather $B$ and all real numbers in between. And yes, I want a smooth monotonic function the way you described, but one that maps $[0,a_n] \rightarrow [0 .. n]$. $\endgroup$ – rsp1984 Jul 1 '18 at 14:10

Look up monotone splines, e.g. Wikipedia Monotone_cubic_interpolation.
(Normal cubic splines, see e.g. Numerical Recipes pages 120-122, are simpler but, surprisingly, may be non-monotone for monotone data.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.