Optimal Interpolation Nodes
Computes a set of points with an optimal Lebesgue constant. Having an exact analytical solution for these points is an unresolved problem in mathematics. The code here approximates the values numerically. Numerical approximations have been available for many years, but to my knowledge, there are no other open source Python libraries with this functionality.
Usage
Installation
pip install optinterp
Example
import optinterp
nds = optinterp.nodes(10)
This functions similarly to numpy's chebpts1 but produces points with a slightly improved Lebesgue constant:
import numpy as np
nds = np.polynomial.chebyshev.chebpts1(10)
nds = nds / nds[-1]
Algorithm Description
This solution expoits the following properties:
- Optimal interpolation points can take values -1 and 1 for their minimum and maximum.
- To mimimize the global maximum of the Lebesgue function, all local maxima should be equal.
- Moving two adjacent nodes closer together reduces the local maximum of the Lebesgue function at the expense of increasing the other local maxima.
Start with two initial guesses for optimal points. The extended Chebyshev nodes and a set of slightly perturbed Chebyshev nodes. Then for each set of nodes define:
dx_i = x_{i+1} - x_i
dL_i = L_i - L_{avg}
Where L_i is the local maximum of the Lebesgue function between x_{i+1} and x_i. Now assuming each dL_i is a function of dx_i, use the Secant method to find roots:
dx_{i, n+1} = dx_{i, n} - dL_{i, n} * (dx_{i, n} - dx_{i, n-1}) / (dL_{i, n} - dL_{i, n - 1})
For the next iteration, calculate each node x_i from these roots of dx_i and scale the values to be from -1 to 1.
Metadata
Release files for optinterp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| optinterp-0.1.0.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| optinterp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.3 kB
Release files / optinterp-0.1.0.tar.gz
| Download URL | optinterp-0.1.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13c43deb26ce260d1dd07783d02febedfad098b5f9046598c04cfb55c2c845f4
|
|
BLAKE2b-256 checksum How to use checksums |
275e399ecfd8752d4a978b4fb0576ef8033ef4530ed9b97d8eecd809563ceb26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
|
Release files / optinterp-0.1.0-py3-none-any.whl
| Download URL | optinterp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b82d7cd8b136ec6c6a92f7768b9c91b509dd332a7e8f50140c4281f8ccea436a
|
|
BLAKE2b-256 checksum How to use checksums |
2bd4cdd8dccdba6b915f296f041542c04f2cbc59ea76b20f6fc76da4ae9b27d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
|