Catalog PyPI
Back to packageRELEASE DETAILS

1.0.2

PyPI

aaa-approx

A Python implementation of the AAA algorithm for rational approximation

Published31 Jan 2019
Direct dependencies2
Transitive dependenciesNot calculated

README

Version 1.0.2 documentation

The AAA algorithm for rational approximation Build Status

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. (doi)

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.

The "cleanup" feature for spurious poles and zeros is not currently implemented.

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

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 2

Native requirements
2 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
numpy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "",
  "evaluation": "NOT_EVALUATED"
}
numpy (>=1.11)runtime
scipy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": "",
  "evaluation": "NOT_EVALUATED"
}
scipyruntime

Distribution files

2 collected
aaa_approx-1.0.2-py3-none-any.whl

bdist_wheel · 4.04 KB · Python py3

Source file
aaa-approx-1.0.2.tar.gz

sdist · 5.14 KB · Python source

Source file

Repository

PENDING
c-f-h/aaa

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 16:46 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:27d74e294c8ba95de1faaf24ee1bf140047fe32eaaf2c1fe79fdc50e4fbf65e9

Other collected versions

View all collected versions →