Natural cubic spline workspace
Interpolate an ordered point set with natural endpoint conditions and export samples.
A clear answer. Here’s how.
Sorts 2–500 points by X, requiring separations greater than 10⁻¹⁰. Solves the natural cubic spline tridiagonal system with zero second derivatives at both endpoints. The spline passes through supplied points; it is not a smoothing fit and does not extrapolate. First output row is the query, followed by 101 evenly spaced curve samples.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- CSV: X,Y
X,Y 0,1 1,2 2,5 3,10
- Query X inside the data range
- 1.5
Example result
| X | Interpolated Y |
|---|---|
| 1.5 | 3.2 |
| 0 | 1 |
| 0.03 | 1.0180108 |
| 0.06 | 1.0360864 |
| 0.09 | 1.0542916 |
First row is your query; remaining rows sample the supplied X range. Natural cubic spline: second derivatives are zero at both endpoints; no extrapolation.