cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

ValeryOchkov
24-Ruby IV

Spline

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

PB-1.png 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions

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

 

View solution in original post

6 REPLIES 6

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

 

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.

Very nice. I could have used this several times over the last few years (instead of my own home-brewed kludge).

SMath has lspline and pspline. With 2 or 3 arguments

PB-2.png

Two picture from the chapter 15 Hydropower "Thoughts and Calculations when Looking at a Banknote or Spline Interpolation" of the book

STEM Problems with Mathcad and Python - 1st Edition - Valery Ochkov - (routledge.com)

8-8.png8-1.png

 

To be honest, I was expecting such an answer. I have a problem and I didn't solve it with the function lspline, but I solved it with a function cspline.

I have a problem and I didn't solve it with the function lspline, but I solved it with a function linterp.

 

Announcements

Top Tags