[SciPy-dev] Matlab versus scipy

Nils Wagner nwagner at mecha.uni-stuttgart.de
Thu Oct 20 07:25:32 EDT 2005


Hi all,

Matlab offers a warning in case of nearly singular matrices

Matrix is close to singular or badly scaled
Results may be inaccurate

scipy doesn't have this feature. For what reason ?

Nils

from scipy import *
a = rand(3,3)
#a = 0.5*(a+transpose(a))
w = linalg.eigvals(a)
#
# Singular matrix
#
s = a-w[0]*identity(3)

dets=linalg.det(s)
svds=linalg.svdvals(s)
evals=linalg.eigvals(s)
print evals
print svds[0]/svds[-1]
invs=linalg.inv(s)
print invs





More information about the SciPy-Dev mailing list