star-spline 0.1.0
Natural cubic spline, correctly rounded
Public state: Released & Verified. The registry label is RELEASED. What the states mean →
Apache-2.0 Released & Verified single file
Summary
Natural cubic spline through 2 to 300 tabulated points: values, first derivative, second derivatives at the knots and integral, with the tridiagonal system solved in exact rational arithmetic and every result rounded once; within 8e-15 of SciPy and Hipparchus on 151 unevenly spaced tables.
Run in your browser
Edit the code and press Run (or Ctrl+Enter). Python runs in your browser with this package's published code. The first run downloads Python once (about 12 MB).
Runs in the browser: all 29 tests pass in the browser's Python (Pyodide 314.0.7, Python 3.14.2), measured on 20 October 2026.
Use it on your computer
No account and no GitHub needed. Download, then install with one command:
- Install file · star_spline-0.1.0-py3-none-any.whl 3 kB
- Single file — copy it alongside your code · star_spline.py 6 kB
- Source code (.zip) 23 kB
python -m pip install star_spline-0.1.0-py3-none-any.whlIn Python: import star_spline
Cite it, and its bill of materials
For a paper, a report or a supplier file: the citation in two formats, and the software bill of materials (SBOM) in the two standard formats, with the fingerprint of the wheel.
@software{cavazzini_star_spline_0_1_0,
author = {Cavazzini, Andrea},
title = {{star-spline}: Natural cubic spline, correctly rounded},
version = {0.1.0},
year = {2026},
url = {https://andrea07072000.github.io/S.T.A.R.-/software/star_spline/},
note = {Apache-2.0. Source: https://github.com/Andrea07072000/S.T.A.R.-, commit dc09f61d}
}
For developers
Install directly from the public repository:
python -m pip install "star-spline @ git+https://github.com/Andrea07072000/S.T.A.R.-.git@dc09f61dcee098d518f070d6a23a8815defc1109#subdirectory=packages/star_spline"
Technical sheet
Requirements
- R1
values(xs, ys, points)andderivatives(xs, ys, points)return the natural cubic spline through the points (xs strictly increasing) and its first derivative at each point;second_derivatives(xs, ys)its second derivative at the knots (zero at the two ends);integral(xs, ys, a, b)its integral between two abscissas of the table. - R2 The tridiagonal system is solved in exact rational arithmetic on the floats given and each result is evaluated exactly and rounded once: knots very close together, values far from zero or a long table cost no digit.
- R3 Measured on 151 tables of 3 to 40 unevenly spaced knots, 25 points each: values within 8e-15 and first derivatives within 2e-14 of SciPy (relative to the scale of each table), second derivatives within 2e-12, the integral within 3e-13; values within 7e-15 and first derivatives within 2e-15 of Hipparchus.
- R4 Every function returns floats or raises
ValueError: tables that are not 2 to 300 finite real numbers within 1e100, different lengths, knots that are not strictly increasing, a point outside the table (a spline is not extrapolated), a result too large for a float.
Limits (what is not claimed)
The natural end condition only (zero second derivative at both ends): no clamped, not-a-knot or periodic spline, no smoothing spline, no extrapolation. A spline through noisy or unevenly sampled data can overshoot between the knots; exact arithmetic does not make it a good model. Exact arithmetic is slow: about a second for a table of 300 knots, and every call solves the table again (pass all the points you need in one call). Nothing beyond 300 knots. "Nearest float" refers to the floats passed in, not to the decimal numbers you may have meant.
Release gate
Computed by the registry from the result files, with the same function that decides RELEASED.
- Mutation score, latest measure of each module (needs at least 0.850)
- star_spline.py 0.945 (2026-10-07)
- Independent implementations written by others (needs 2)
- Hipparchus SplineInterpolator, scipy.interpolate.CubicSpline (natural)
- Result
- Released & Verified
Evidence in the registry
| Check | Status | Recorded | What was observed |
|---|---|---|---|
| Clean install from the release tag | VERIFIED | 2026-10-07 | pytest outside the tree: 29 passed in 0.29s |
| Unit tests | VERIFIED | 2026-10-07 | 29 passed in 0.51s |
| Review | VERIFIED | 2026-10-07 | Requirements, interface, units, data provenance, dependency surface and failure behaviour reviewed |
| Review | VERIFIED | 2026-10-07 | Re-running the cross-check gives a byte-identical evidence file |
| Reference value | VERIFIED | 2026-10-07 | values([1, 2, 3], [2, 3, 5], [1.5, 2.5]) = (2.40625, 3.90625); second_derivatives = (0.0, 1.5, 0.0) (suite: 29 passed in 0.51s) |
| Cross-check with independent libraries | VERIFIED | 2026-10-07 | star_spline returns the natural cubic spline of two independent libraries, with every value rounded once from an exact solution |
| Benchmark | VERIFIED | 2026-10-07 | largest relative difference of a value from SciPy: 7.2e-15; from Hipparchus: 6.7e-15 |
Fingerprints (SHA-256)
| star_spline-0.1.0-py3-none-any.whl | 24ccc0ee6622fe252b512569896acc164055b71da6439890b17670fd106dd4fa |
| star_spline.py | 194f69e9c6c0fbff1da40334159cbb1bc4cfa95b2761aec47ce12c65d5ca5876 |
| star_spline-0.1.0-source.zip | 0a264c5cb087a03517cd0baf396a8124772abfd4b42dafdce65d9e9e82b91cbe |
