Projection
How to let a new spline with a new degree and delay best approximate a given spline of a given degree and delay.
Formulation
Let a given piecewise polynomial periodic spline be specified by its positive integer period \(K\in{\mathbb{N}}+1,\) its nonnegative integer degree \(n_{0}\in{\mathbb{N}},\) and its delay \(\delta x_{0}\in{\mathbb{R}}.\) It is the function
where \(\left(c_{0}[k]\right)_{k=0}^{K-1}\) is the vector of its spline coefficients and \(\beta^{n_{0}}:{\mathbb{R}}\rightarrow{\mathbb{R}}\) is a B-spline of degree \(n_{0}.\) We want to find the vector \(\left(c[k]\right)_{k=0}^{K-1}\) of spline coefficients that minimizes the continuous least-squares criterion
where \(f\) is the spline \(f:{\mathbb{R}}\rightarrow{\mathbb{R}},x\mapsto f(x)=\sum_{k\in{\mathbb{Z}}}\,c[{k\bmod K}]\,\beta^{n}(x-\delta x-k)\) with same period \(K\) but with possibly different degree \(n\in{\mathbb{N}}\) and delay \(\delta x\in{\mathbb{R}}.\)
By analogy with the linear-algebra terminology, the spline \(f\) is said to be the projection of the spline \(f_{0}\) onto the space of splines of degree \(n\) and delay \(\delta x.\)
Solution
The coefficients that minimize the criterion \(J\) are
for all \(k\in[0\ldots K-1].\) Letting \({\mathbf{[\![}}\cdot\,{\mathbf{]\!]}}\) be the notation for the Iverson bracket, the sequence \(\left(\left(b^{2\,n+1}\right)^{-1}[q]\right)_{q\in{\mathbb{Z}}}\) is such that \(\sum_{q\in{\mathbb{Z}}}\,\left(b^{2\,n+1}\right)^{-1}[q]\,\beta^{2\,n+1}(k-q)={\mathbf{[\![}}0=k\,{\mathbf{]\!]}}.\)
We now propose a few lines of code that first create a random spline of specified period, degree, and delay, and then determine which spline of arbitrary new degree and delay best approximates it.
Jupyter Lab notebook