Satisfying conditions in periodic splines

interpolationnumerical methodsspline

Find periodic cubic spline equations in interval [-1,1] and corresponding values of -1, 0, 1 which interpolate function f with these given points:
f(-1) = 1, f(0) = 2, f(1)=1

I know how to work with natural and clamped splines but I don't know how to use conditions of periodic splines to find the answer. The conditions are:

S'(a) = S'(b) and S"(a) = S"(b)

I have checked multiple resources about periodic splines but it wasn't helpful.

I appreciate if someone can help me with this.

Best Answer

Consider the general $3$rd degree "basis spline" (sometimes called "bump spline") defined on the interval $[x_0-2h,x_0+2h]$ in four parts in the following way:

$$\varphi(x)=\begin{cases}\tfrac16(2h+(x-x_0))^3& x \in [x_0-2h,x_0-h]\\ k-\tfrac12(x-x_0)^2(2h+(x-x_0))& x \in [x_0-h,x_0]\\ k-\tfrac12(x-x_0)^2(2h-(x-x_0))& x \in [x_0,x_0+h]\\ \tfrac16(2h-(x-x_0))^3& x \in [x_0+h,x_0+2h] \end{cases} \ where \ k:=2h^3/3.$$

In our case, $h=\tfrac12$ and $x_0=0$, giving simplified expressions:

$$\varphi(x)=\begin{cases}\tfrac16(x+1)^3& x \in [-1,-\frac12]\\ \tfrac{1}{12}-\tfrac12 x^2(x+1)& x \in [-\frac12,0]\\ \tfrac{1}{12}-\tfrac12 x^2(1-x)& x \in [0,\frac12]\\ \tfrac16(1-x)^3& x \in [\frac12,1] \end{cases}$$

with this graphical representation:

enter image description here

As $\varphi(0)=\tfrac{1}{12}$ and $\varphi(-1)=\varphi(1)=0$, take $$f(x)=12 \varphi(x) + 1$$ in order to comply with conditions $f(0)=2$ and $f(-1)=f(1)=1$.

Afterwards, replicate it in a periodic way by taking $x_0=2n$ for any integer $n$:

enter image description here

Remarks:

  1. You can check that the continuity conditions of $f$, $f'$ and $f''$ are fulfilled at the "connections".

  2. For explanations, and more generaly a nice presentation of splines, see this slideshow.