On 04/20/2010 03:29 PM, wb wrote:
I must be doing something wrong, trying to get eigenvectors
for a rather small hermitean 64x64 matrix 'm' (it is listed at the
end)
When I try to do

sage: m.eigenvalues()

sage departs into 'nirvana' and I have interupted the evaluation after
several minutes

When I do this in mathematica for the same matrix I get

Eigenvalues[m] // Timing

{1.5801,<-------------- !!

  {1/2 (2 + Sqrt[13]), 1/2 (2 + Sqrt[5]), 1/2 (2 + Sqrt[5]),
   1/2 (2 + Sqrt[5]), -(3/2), -(3/2), -(3/2), -(3/2), -(3/2), -(3/
    2), -(3/2), 3/2, 1/4 (1 + Sqrt[17]), 1/4 (1 + Sqrt[17]),
   1/4 (1 + Sqrt[17]), 1/4 (1 + Sqrt[17]), 1/4 (1 + Sqrt[17]),
   1/4 (1 + Sqrt[17]), -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1,
    1, 1, 1, 1/2 (2 - Sqrt[13]), 1/4 (1 - Sqrt[17]),
   1/4 (1 - Sqrt[17]), 1/4 (1 - Sqrt[17]), 1/4 (1 - Sqrt[17]),
   1/4 (1 - Sqrt[17]), 1/4 (1 - Sqrt[17]), -(1/2), -(1/2), -(1/2), 1/2,
    1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 1/2 (2 - Sqrt[5]), 1/2 (2 - Sqrt[5]),
    1/2 (2 - Sqrt[5]), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}


Any help? Thanks.
wb


Here is a much faster way to get the eigenvalues (I've put the matrix into the file m.sage):

sage: load('m.sage')
sage: a=m.change_ring(QQbar)
sage: c=a.charpoly()
sage: c
x^64 - 36*x^62 - 12*x^61 + 1197/2*x^60 + 378*x^59 - 12141/2*x^58 - 11007/2*x^57 + 2679939/64*x^56 + 393673/8*x^55 - 3317427/16*x^54 - 9693063/32*x^53 + 387496215/512*x^52 + 174574467/128*x^51 - 1048421907/512*x^50 - 2384940951/512*x^49 + 131411556027/32768*x^48 + 25284797649/2048*x^47 - 42052511021/8192*x^46 - 105481779291/4096*x^45 + 282035095659/131072*x^44 + 1395376924629/32768*x^43 + 1023830281485/131072*x^42 - 7325141148621/131072*x^41 - 97935162382533/4194304*x^40 + 30339258515091/524288*x^39 + 39381389585415/1048576*x^38 - 97499421492393/2097152*x^37 - 1430999868558231/33554432*x^36 + 233821582530345/8388608*x^35 + 1225664638932435/33554432*x^34 - 376071447875733/33554432*x^33 - 103537846826210799/4294967296*x^32 + 228998954522163/134217728*x^31 + 13200985892278611/1073741824*x^30 + 1428341168223567/1073741824*x^29 - 5153890226395845/1073741824*x^28 - 1341020300522463/1073741824*x^27 + 94059441785619/67108864*x^26 + 618106802986071/1073741824*x^25 - 626302225881909/2147483648*x^24 - 187960388505255/1073741824*x^23 + 20576287455111/536870912*x^22 + 39568400494029/1073741824*x^21 - 1863082614897/1073741824*x^20 - 5680332994805/1073741824*x^19 - 51871766823/134217728*x^18 + 519259224501/1073741824*x^17 + 359998987329/4294967296*x^16 - 24918300621/1073741824*x^15 - 7419358377/1073741824*x^14 + 19402335/134217728*x^13 + 57520287/268435456*x^12 + 1646811/67108864*x^11 + 59049/67108864*x^10
sage: c.roots()
[(-1.5000000000000000?, 7), (-1, 10), (-0.8027756377319946?, 1), (-0.7807764064044151?, 6), (-0.50000000000000000?, 3), (-0.1180339887498949?, 3), (0, 10), (0.50000000000000000?, 7), (1, 6), (1.280776406404415?, 6), (1.5000000000000000?, 1), (2.118033988749895?, 3), (2.802775637731995?, 1)]

It still took far too long, I think (~30 seconds). If you're okay with numeric approximate eigenvalues, it can be much faster:
sage: b=m.change_ring(CDF)
sage: b.eigenvalues()
[2.80277563773 - 1.83886055434e-19*I, 2.11803398875 - 2.71788581415e-19*I, -1.5 + 1.58379106525e-18*I, 2.11803398875 - 8.1521856504e-18*I, 1.5 + 4.09470009356e-19*I, 2.11803398875 - 5.38812369584e-17*I, -1.5 + 2.2208483597e-16*I, -0.802775637732 + 6.36227924417e-18*I, -1.5 - 8.79953651898e-18*I, -0.11803398875 - 9.5409791222e-18*I, -0.11803398875 + 3.75621793854e-17*I, -1.5 - 7.83206940977e-17*I, -0.11803398875 - 3.79601573438e-17*I, -1.5 + 6.07623242327e-18*I, 1.2807764064 - 6.09069496501e-17*I, -0.5 + 3.87845272648e-17*I, 1.2807764064 - 4.16221064047e-17*I, -0.5 + 4.21743718863e-17*I, 1.2807764064 - 5.57627104785e-17*I, -0.5 - 7.60128320678e-18*I, 1.2807764064 - 2.47799620581e-17*I, 1.0 + 1.43988379379e-18*I, 1.2807764064 - 9.411599375e-17*I, 1.0 + 4.79058772159e-17*I, 1.0 + 3.73848333822e-17*I, 1.0 - 2.08160087877e-18*I, 1.0 - 5.55712825845e-17*I, 1.2807764064 - 3.67649700338e-17*I, 1.0 - 7.14667119153e-17*I, -0.780776406404 + 2.94902990916e-17*I, -0.780776406404 + 2.46061085944e-17*I, -0.780776406404 + 4.16333845244e-17*I, 0.5 + 5.55111314853e-17*I, -0.780776406404 + 4.16333599554e-17*I, 0.5 + 6.9388972861e-18*I, -0.780776406404 - 6.73560593722e-18*I, 0.5 + 2.86994948465e-17*I, -1.0 + 2.61091278963e-17*I, -1.0 + 1.08884778248e-17*I, -1.0 + 1.53318485076e-17*I, 0.5 - 1.66229510626e-17*I, -1.0 + 2.74997764168e-17*I, 0.5 - 1.14623471734e-16*I, -1.0 + 9.90651705936e-17*I, 0.5 - 2.71430756267e-17*I, 0.5 + 3.4246303938e-18*I, -0.780776406404 + 2.94136380324e-17*I, -5.53009816376e-17 - 1.76283414899e-17*I, 1.96969784613e-17 - 3.83662745175e-17*I, -1.0 - 1.76122333653e-17*I, -1.0 - 1.61032638984e-16*I, 1.01294275297e-18 - 3.20184498425e-17*I, -1.0 + 5.77316096292e-17*I, -7.2826494895e-18 + 6.03294949321e-17*I, -1.0 - 5.02330523917e-17*I, 1.57456979764e-16 + 6.40417086472e-17*I, -1.0 + 8.49334913385e-17*I, -1.59491862682e-16 + 1.20711150911e-16*I, 2.37002755035e-16 - 1.88853631166e-16*I, -1.47077030986e-17 - 7.68878194376e-17*I, 8.59357038355e-17 - 3.97374934893e-17*I, 2.2381102943e-16 + 1.39666599327e-16*I, -1.5, -1.5]


The printing of the eigenvalues is marginally improved by http://trac.sagemath.org/sage_trac/ticket/8626, which tries to print things using square roots.

Thanks,

Jason


--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to