Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 3232 by [email protected]: Problem getting eigenvector
resolution of matrix
http://code.google.com/p/sympy/issues/detail?id=3232
Following this suggestion (http://stackoverflow.com/a/6879889) I've tried
to use sympy to (numerically) get the eigenvalues of a matrix. Here's some
code that reproduces (some of) my problems. It's not exactly what I did but
it conforms to the suggestion at stackoverflow.com (I don't understand
why 'data' is originally defined using the SingletonRegistry class but
that's another story; copying that didn't seem to help):
Python 2.6.5 (r265:79063, Feb 28 2011, 21:55:45)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
from sympy import exp, N, S
from sympy.matrices import Matrix
data=
[[S("-0.0107018068735"),S("0.0107018068734692"),S("0.0"),S("0.0"),S("0.0")],[S("1000000"),S("-2000000.00000"),S("1000000"),S("0.0"),S("0.0")],[S("0.0"),S("520562.928745815"),S("-1520562.92875"),S("1000000"),S("0.0")],[S("0.0"),S("0.0"),S("0.207438741238170"),S("-1000000.20744"),S("1000000")],[S("0.0"),S("0.0"),S("0.0"),S("51101.7671153520"),S("-51101.7671154")]]
m=Matrix(data)
ex=m.applyfunc(lambda x:N(x, 50)) #doesn't work for any precision
ex=ex.transpose() #ignore this; it has to do with the meaning of the
matrix
vecs=ex.eigenvects()
vecs
[]
(You can hear the crickets chirping...)
I know that's a wrong result because I can evaluate the same matrix
(attached) with Octave and the results make sense:
m=load('matrix.dat');
[evecs,evals]=eig(m'); %
diag(evals)
ans =
-2.5206e+06
-1.0511e+06
-1.0000e+06
-6.9588e-08
-6.3287e-03
Unfortunately, for some of the matrices I'm working with I exceed the
numerical precision of Octave and get complex eigenvalues and junk. So I
need either 128-bit floats or an arbitrary precision library, which is what
brought me to sympy.
Ryan
Attachments:
matrix.dat 251 bytes
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.