# Help with evaluation of the differential of a BSplineFunction?

It can be useful to generate a smooth random function over $$[-L,L]$$ with BSplineFunction:

L=10;
SeedRandom[1]
f[x_] = BSplineFunction[RandomReal[{-1, 1}, 20], SplineClosed -> True][x/(2*L)]


It is easy to plot f[x]

Plot[f[x], {x, -L, L}, PlotRange -> {{-L, L}, All}, Axes -> False, Frame -> True, AspectRatio -> 0.5]


However, sometimes we also want to use its derivatives in a numerical computation, for example, D[f[x], {x, 3}]. Before using it, let us observe its curve first, which becomes many steps! Obviously, such a function is NOT the derivative of f[x] and cannot be used in numerical computations.

Plot[Evaluate[D[f[x], {x, 3}]], {x, -L, L}, PlotRange -> {{-L, L}, All}, Axes -> False, Frame -> True, AspectRatio -> 0.5]


I have not figured out the reason. Any suggestion? Thanks in advance!

It's no surprise that you get a step function with 3 derivatives, since the default SplineDegree is 3. If you want to take 3 derivatives, you should up the SplineDegree:
L = 10;

Plot[f'''[x], {x, -10, 10}]