I want to implement natural cubic splines in Julia via B-splines (which are a basis for splines). I found CompactBases.jl, which uses B-splines and allows me to evaluate the basis functions at a value `x`

.

Now, let the set of knots be t = \{\zeta_1, \dots, \zeta_K\}. Splines split \mathbb{R} into K+1 segments, (-\infty, \zeta_1], (\zeta_1,\zeta_2],\dots,(\zeta_K, \infty) and use polynomials (here cubic) in each segment. Natural splines make the function linear in the boundary segments, (-\infty, \zeta_1] and (\zeta_K,\infty).

However, when I implement them via CompactBases, the polynomial seems to be of order zero (a constant) rather than one (linear). See the below MWE, where I try to approximate \sin{x} over -6:6 but let t be in -5:5.

Outside -5:5, the approximation is just constant (at zero). Any help would be appreciated.

```
using Plots
using CompactBases
t = LinearKnotSet(4, -5, 5, 3)
B = BSpline(t)
x = [-6:0.01:6;]
y = sin.(x)
c = B[x,:] \ y
X = B[x,:]
approx = X*c
plot(x,[y, approx])
```