What kind of spline algorithm is used?

Angsüsser shared this question 5 years ago

I created a javascript-module, which creates a cubic spline function from a list of points named "pointL". I used the usual assumptions for spline S(x):

S_i(x_i)=S_{i+1}(x_i) and first and second derivative match there.

When I use my module and geogebra spline-command - they differ. So I believe the "Spline"- command deliver not such a thing that in literature is meant by "cubic spline". So what is it?

I attached a file for demonstration

Comments (3)


Thank you that you pointed out that I should read the "comment" -- I really should (sorry). But why not the usual algorithm? Is there an advantage? Can you integrate or take a derivative of that sort of spline?

The second link seems to be broken:



Would your method work if two of the points were in line vertically?


Sorry for the late answer- was on Easter-vacation;

Of course not - returned are piecewise continuous differentiable #functions# - not curves!

The x-coordinates of the based 2D points therefore must be in strict increasing (equal not allowed) order - that's a severe restriction but the repay is that this thing (cubic spline) is differentiable and integrable - that was the cause why I built this thing (you can use the Geogebra "Derivative" and "Integrate" commands) - but I see no easy way (should I think twice?) to do this with the builtin "Spline" command.

The advantage - without doubt - is: you can use the builtin "Spline" command in any dimension context and the direction of the 2D graph of the points maybe "backwards". So the anwser of "what is bettter?" is a question of "what do you have in mind?".

© 2023 International GeoGebra Institute