Alglib/Python spline functions

Continuing from the previous post, the new spreadsheet includes functions for 1D and 2D linear and cubic splines.

xl_Spline2-1The basic 1D spline allows  for output of linear splines, or 5 different types of cubic spline, as listed above.

Output may be spline values at listed points, spline parameters for each spline segment, or spline integration or slope.

Additional data allows input of end slopes or curvatures for cubic splines, slope data for hermite splines, or end type and tension for Catmull-Rom splines:

The screenshots below show input and results for all six spline types, passing through 5 points:


Output of spline segment data, integration, and slope and curvature values is shown below:

Input and output for the 2D spline function is shown below.

The screenshots below show 2D splines fitted to tabular data for air density under varying pressure and temperature:


The xl_Spline1DFit function finds the least squares fit of a cubic spline with a specified number of segments, with optional weighting and/or constraints:

Alternative spline fits:


The xl_SplineInt and xl_SplineDiff functions provide integration and differentiation data for any of the spline types. They are equivalent to output options 3 or 4 with the xl_Spline1d function:


This entry was posted in AlgLib, Excel, Link to Python, Maths, Newton, Numerical integration, UDFs, VBA and tagged , , , , , , , , , , , . Bookmark the permalink.

One Response to Alglib/Python spline functions

  1. Great article. Nicely pointed out. Thanks for sharing.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s