Hi again everyone, thanks again for the all the suggestions so far.

Currently I am basing a trial calc on the example from jipolanco.

I am substituting very fine sampling of the splines for an “integral”.

My concerns are that the first and last couple of points of the spline interpolation seem to be bad fits; and more importantly, each time I run the program (with different randomized time points), the final integrated number is different, even though the underlying function is the same.

I’ve tried pumping up the spline interpolation order, and the number of sampled time points (which I couldn’t do with my real data). That makes the variation less, but still very large.

If anyone has any ideas on how to get a more consistent result, please let me know!

Here is my code:

```
using Plots
# using Interpolations
using BSplineKit
# Actual function and its derivatives:
f(x) = sin(x)/x + ((x^2)/10.0)
fP(x) = (cos(x)/x) - (sin(x)/x^2) + (2.0*x/10.0)
fPP(x) = -(2*cos(x)/(x^2)) + (2*sin(x)/(x^3)) - (sin(x)/x) + (2.0/10.0)
t = sort([((19.0*rand(Float64))+1.0) for i in 1:57])
S = spline(BSplineKit.interpolate(t, f.(t), BSplineOrder(12)))
Sd1 = diff(S, Derivative(1))
Sd2 = diff(Sd1, Derivative(1))
RCurv(x) = (((1.0+(Sd1(x)^2))^(3/2))/abs(Sd2(x)))
IntegrateStep = (t[end-2]-t[3])/(10000-1)
IntegrateRange = t[3]:IntegrateStep:t[end-2]
RCurvDel = RCurv.(IntegrateRange)
RCurvIntegratedAverage = sum(RCurvDel)/length(RCurvDel)
println("\n","RCurvIntegratedAverage = ",RCurvIntegratedAverage,"\n")
```

And here are some plotting commands to visualize it:

```
plot(IntegrateRange,RCurvDel)
PlotRng = 1.0:0.001:20
RealVsSplineFunctionPlot = plot(PlotRng, f.(PlotRng), color="aqua", linewidth=7.0);
scatter!(t, f.(t), markersize=9, color = "blue", legend = false);
plot!(PlotRng, S.(PlotRng), color="red", linewidth=2.0);
scatter!(t, S.(t), color="red", markersize=5); display(RealVsSplineFunctionPlot)
#
RealVsSplineFIRSTDerivPlot = plot(PlotRng, fP.(PlotRng), color="aqua", linewidth=7.0);
scatter!(t, fP.(t), markersize=9, color = "blue", legend = false);
plot!(PlotRng, Sd1.(PlotRng), color="red", linewidth=2.0);
scatter!(t, Sd1.(t), color="red", markersize=5); display(RealVsSplineFIRSTDerivPlot)
#
RealVsSplineSECONDDerivPlot = plot(PlotRng, fPP.(PlotRng), color="aqua", linewidth=7.0);
scatter!(t, fPP.(t), markersize=9, color = "blue", legend = false);
plot!(PlotRng, Sd2.(PlotRng), color="red", linewidth=2.0);
scatter!(t, Sd2.(t), color="red", markersize=5); display(RealVsSplineSECONDDerivPlot)
```

Thanks!