You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For comparison, it does not happen with cubic splines from e.g. Dierckx:
using Dierckx, Plots
t =0.0:0.01:1.0
y =@. t^2# -> y′ = 2*t, y″ = 2
yspl =Spline1D(t, y; k=3)
plot(t, yspl(t); label ="y")
plot!(t, t -> Dierckx.derivative(yspl, t; nu=1); label ="y′")
plot!(t, t -> Dierckx.derivative(yspl, t, nu=2); label ="y″")
Now that I have thought more about this: is this just an effect of the choice of boundary conditions on the splines, as in this thread? ?DataInterpolations.CubicSpline does say it is using natural boundary conditions, which means the second derivative is forced to 0 at the ends. I chose a function whose derivative is exactly 2 everywhere, so that must create some "tension" at the ends?
The second derivative is very noisy near the spline endpoints:
The first derivative looks much better, but also looks more kinky than it should near the ends (?) 🙂
The text was updated successfully, but these errors were encountered: