PseudoPy computes and visualizes the pseudospectrum of a matrix. It is a Python version of the original eigtool by Thomas G. Wright. The algorithms used in this package can be found in the book Spectra and pseudospectra by Nick Trefethen and Mark Embree.
The pseudospectrum of the Grcar matrix looks like this:
If no knowledge about the location of the pseudospectrum of the given matrix is available, the following lines of code can be used to obtain an approximation:
from pseudopy import NonnormalAuto, demo from matplotlib import pyplot from scipy.linalg import eigvals # get Grcar matrix A = demo.grcar(32).todense() # compute pseudospectrum for the levels of interest between [1e-5, 1] pseudo = NonnormalAuto(A, 1e-5, 1) # plot pseudo.plot([10**k for k in range(-4, 0)], spectrum=eigvals(A)) pyplot.show()
PseudoPy depends on numpy, scipy, matplotlib and shapely. If you are on Debian/Ubuntu, you can install these dependencies with
sudo apt-get install python-numpy python-scipy python-matplotlib python-shapely
pip install pseudopy
Note that you may need to add
sudo if you want to install it system-wide.
PseudoPy is free software licensed under the MIT License.