Skip to main content
24-Ruby IV
April 19, 2023
Solved

Spline

  • April 19, 2023
  • 1 reply
  • 2175 views

Why we have 3 functions lspline, pspline and cspline? Can we have only one spline?

PB-1.png 

 

 

 

Best answer by terryhendicott

Hi,

The second derivative at the endpoints for each function is as follows:
cspline—Determined by the straight line through the nearest two points.
lspline—Equals to 0.
pspline—Equals to the value of the next nearest point.

 

There is a fourth spline possibility.  Call it a dspline? A spline can be put through n points in the XY plane if you also specify the derivatives or slope at each end point of the spline.  I used to do this with roller coasters so the curved track could match slope of straight portions at start/finish.  Using this method no extrapolation is possible.

 

Capture.JPG

The four splines looking closely at first two points.  Each is subtly different.

Capture2.JPG

 

1 reply

21-Topaz II
April 19, 2023

Hi,

The second derivative at the endpoints for each function is as follows:
cspline—Determined by the straight line through the nearest two points.
lspline—Equals to 0.
pspline—Equals to the value of the next nearest point.

 

There is a fourth spline possibility.  Call it a dspline? A spline can be put through n points in the XY plane if you also specify the derivatives or slope at each end point of the spline.  I used to do this with roller coasters so the curved track could match slope of straight portions at start/finish.  Using this method no extrapolation is possible.

 

Capture.JPG

The four splines looking closely at first two points.  Each is subtly different.

Capture2.JPG

 

16-Pearl
April 19, 2023

As "terryhendicott" points out, each option provides the flexibility to more closely fit a cubic spline representation to the function/response you may need to model, because of the end-point conditions. I've used 2 variations in the past to mimic the behavior of a system that requires each of those two conditions at their endpoints. It is very useful to have these options available to us.