The AAA algorithm for rational approximation
This is a Python implementation of the AAA algorithm for rational approximation described in the paper "The AAA Algorithm for Rational Approximation" by Yuji Nakatsukasa, Olivier Sète, and Lloyd N. Trefethen, SIAM Journal on Scientific Computing 2018 40:3, A1494-A1522.
A MATLAB implementation of this algorithm is contained in Chebfun. The present Python version is a more or less direct port of the MATLAB version.
Installation
The implementation is in pure Python and requires only numpy and scipy as dependencies. Install it using pip:
pip install aaa-approx
Usage
Here's an example of how to approximate a function in the interval [0,1]:
import numpy as np
from aaa import aaa
Z = np.linspace(0.0, 1.0, 1000)
F = np.exp(Z) * np.sin(2*np.pi*Z)
r = aaa(F, Z, mmax=10)
Instead of the maximum number of terms mmax, it's also possible to specify
the error tolerance tol. Both arguments work exactly as in the MATLAB
version.
The returned object r is an instance of the class aaa.BarycentricRational and can
be called like a function. For instance, you can compute the error on Z like this:
err = F - r(Z)
print(np.linalg.norm(err, np.inf))
If you are interested in the poles and residues of the computed rational function, you can query them like
pol,res = r.polres()
and the zeroes using
zer = r.zeros()
Finally, the nodes, values and weights used for interpolation (called zj, fj
and wj in the original implementation) can be accessed as properties:
r.nodes
r.values
r.weights
Metadata
Release files for aaa-approx 1.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 |
|---|---|---|---|---|
| aaa-approx-1.0.1.tar.gz | 3.8 kB | Without provenance | Details for aaa-approx-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aaa_approx-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for aaa_approx-1.0.1-py3-none-any.whl |
Total release size: 7.8 kB
Release files / aaa-approx-1.0.1.tar.gz
| Download URL | aaa-approx-1.0.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
649d843d212c8b92da3d5256c013bd5a4d9399e43f427f6967aa8940f60bf277
|
|
BLAKE2b-256 checksum How to use checksums |
f8677e1b6d7733d238eb49b3002f917669a204298b635493a42199008e894f87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.5
|
Release files / aaa_approx-1.0.1-py3-none-any.whl
| Download URL | aaa_approx-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
426a761ace11d403735cf6e079277c3b8e420c3e35152ce7b2cf3dd7fec91084
|
|
BLAKE2b-256 checksum How to use checksums |
f597175974ab217e0cae378b05ce6a581beaaae2ec6a3a28350aaa803c1f7350
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.5
|
Security for aaa-approx 1.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.