Lagrange Polynomials
Module to generate Lagrange polynomials over integers for 1-dimensional data. This is generally useful for interpolation.
Installation
Install with pip.
Usage
Example
from lagrange_polynomial import LagrangePolynomial
xs = range(100)
ys = [f(x) for x in xs] # For some function f
lp = LagrangePolynomial(xs, ys) # Instantiate a polynomial with sequences of
# x- and y-coordinates.
for x in xs:
assert ys[x] == lp(x) # Polynomial will intersect original points
coefficient = lp.basis[0](x) # Get the 0th basis vector at x
Interface
The LagrangePolynomial class takes two equally-sized sequences and an optional integer p.
The instance is a Lagrange polynomial L: x -> L(x) over GF(p). If p is not provided, it defaults to the 8th Mersenne prime M31.
It has a basis property, a LagrangeBasis object subclassing Sequence.
Each element ℓⱼ indexed by integers j in range(len(xs)) is a function taking x to its jth basis vector ℓⱼ(x).
Test
Test with make test.
Metadata
Release files for lagrange-polynomial 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lagrange_polynomial-0.0.1.tar.gz | 3.3 kB | Without provenance | Details for lagrange_polynomial-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lagrange_polynomial-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for lagrange_polynomial-0.0.1-py3-none-any.whl |
Total release size: 7.1 kB
Release files / lagrange_polynomial-0.0.1.tar.gz
| Download URL | lagrange_polynomial-0.0.1.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35d851dcc3e67f978e2a3827a93810632c73f3eef90b8bff656956974e7b78b7
|
|
BLAKE2b-256 checksum How to use checksums |
d5f9e42033444b363d3911ccd9c560c39c3a0d528cc709518cbb44c8886731f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Release files / lagrange_polynomial-0.0.1-py3-none-any.whl
| Download URL | lagrange_polynomial-0.0.1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
850b702ea1aabcfc0d6f82dd4a64387b8cff7c386d2198f3fac8176ea31bea32
|
|
BLAKE2b-256 checksum How to use checksums |
a88a24d409ecb2d1b1a4985371571c8281ff85addd0b71b4954ad85fcbc52475
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Security for lagrange-polynomial 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.