Calculates the nth primitive function of a spline.

This is well-defined only modulo an (n-1)-order polynomial.

xy = [-100,4; 8,93; 42,-88; 444, 827]; xmin = min(xy[...;0]); xmax = max(xy[...;0]); eps = (xmax-xmin)/200; xmin -= 2*eps; xmax += 2*eps; x = xmin..eps..xmax; p = splineInterp(xy); print("The interpolating normal cubic spline").title() plot(x, (@(x) splineEval(p,x))(#x)) print("Inverting 2nd derivative").title() s = splineInteg(splineDiff(p,2), 2); plot(x, (@(x) splineEval(s,x))(#x)) print("The difference to the original spline should be a linear:") d = splineAdd(s, splineNeg(p)) plot(x, (@(x) splineEval(d,x))(#x))