Splines and Engineering Functions
Relation of the B-spline \(\beta\) to \(\sin,\) \(\cos,\) \(\exp,\) \({\mathrm{erf}},\) and the Gaussian function.
Sine
The alternating sum of the integer shifts of the first derivative of a B-spline approaches the sine function as the degree tends to infinity. More precisely, it holds that
We give now a piece of code where we verify this property visually over the single period \(\nu\in[-1,1].\)
Jupyter Lab notebook
Cosine
The alternating sum of the half-integer shifts of the first derivative of a B-spline approaches the cosine function as the degree tends to infinity. More precisely, it holds that
We give now a piece of code where we verify this property visually over the single period \(\nu\in[-1,1].\)
Jupyter Lab notebook
Interlude—Trigonometric Exercise
To compute the spline approximation of the sine function, we have given above an explicit approach that relies on a sum of several evaluations of the splinekit.grad_b_spline function. Conversely, to compute the spline approximation of the cosine function, we have given above an approach that relies on the higher-level splinekit.PeriodSpline1D class.
As first exercise, we propose that one computes the spline approximation of the sine by relying on the high-level class. (Hint: it is as simple as commenting out a single line of the spline approximation of the cosine.)
As second exercise, we propose that one computes the spline approximation of the cosine by relying on an explicit approach. The second exercise is more difficult that the first one.
Jupyter Lab notebook
Exponential
The exponential function can be approximated as a weighted sum of the derivatives of B-splines. More precisely, let an arbitrary order of differentiation be \(q\in{\mathbb{N}}\) and let the degree of the B-spline be large enough to allow for \(q\)-times differentiation, by setting it to be \(n=p+q\) with \(p\in{\mathbb{N}}.\) Then, it holds for \(x\in{\mathbb{R}}\) that the B-spline \(\beta^{n}\) is such that
where we have introduced the constant \(a=1/{\mathrm{arcsinh}}(1).\)
We give now a piece of code where we verify this property visually over the range \(x\in[-2,2].\)
Jupyter Lab notebook
Gauss Error Function
Polynomial B-splines are bump-like functions that converge to a Gaussian when the degree grows. More precisely, \(\forall x\in{\mathbb{R}}\) it holds that
where we have introduced the constant \(\sigma_{0}=1/\sqrt{12}.\) Therefore, it is without surprise that the integral of a spline converges to the \({\mathrm{erf}}\) function as the degree grows, too. Indeed, one has \(\forall x\in{\mathbb{R}}\) that
We give now a piece of code where we verify this property visually over the range \(x\in[-3,3].\)
Jupyter Lab notebook
Interlude—Gaussian Exercise
As exercise, we propose to modify the code of the \({\mathrm{erf}}\) case to verify visually that the B-spline of degree \(n\in{\mathbb{N}}\) converges to a Gaussian when the degree grows. As icing on the cake, we suggest to perform the visualization over the support of the approximating B-spline.
Jupyter Lab notebook