Ask Your Question
2

Incorrect Eigenvalues/Eigenvectors

asked 2019-07-30 17:20:19 +0100

zorkkoi gravatar image

I'm trying to compute eigenvalues and eigenvectors for certain matrices. Most of the time sage is giving me what seems to be the correct output, but sometimes it's quite wrong and I'm not sure why this is happening. Here's a concrete example with a circulant matrix.

sage: M=matrix.circulant([1,-1/2*I,0,0,0,0,0,0,0,0,1/2*I])
sage: M.eigenvectors_right()
[(1, [(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)], 1)]

That is, it only returns a single eigenvector when I know there's in fact 11. A different issue appears with matrix.circulant([1,-1/2I,0,0,0,0,1/2I]), where now sage produces all the eigenvalues but produces no eigenvectors for most of these values.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2019-07-30 21:11:10 +0100

Emmanuel Charpentier gravatar image

Your circulant matrix has a characteristic polynomial of degree 11, which has (probably) no explicit solution by radicals ; Sage has herefore little chance of finding them:

sage: M=matrix.circulant([1,-1/2*I,0,0,0,0,0,0,0,0,1/2*I])
sage: M.parent()
Full MatrixSpace of 11 by 11 dense matrices over Symbolic Ring
sage: M.charpoly()
x^11 - 11*x^10 + 209/4*x^9 - 561/4*x^8 + 935/4*x^7 - 1001/4*x^6 + 11011/64*x^5 - 4719/64*x^4 + 4719/256*x^3 - 605/256*x^2 + 121/1024*x - 1/1024
sage: M.charpoly().parent()
Univariate Polynomial Ring in x over Symbolic Ring

However, one can get a designation of these in QQbar. Moving your matrix to QQbar allows you to get your solution:

sage: Mprime=M.change_ring(QQbar)

Now, the characteristic polynomial has its coefficients in QQbar:

sage: Mprime.charpoly().parent()
Univariate Polynomial Ring in x over Algebraic Field

And Sage can use specialied methods for polynomials over QQbar:

sage: EV=Mprime.eigenvectors_right()
sage: len(EV)
11

You have indeed 11 solutions, which are triples (eigenvalue, eigenvector, multiplicity).Let's look at one:

sage: EV[0]
(1.989821441880933?, [
 (1.00000000000? + 0.?e-11*I, -0.14231483828? + 0.98982144188?*I, -0.95949297362? - 0.28173255684?*I, 0.41541501300? - 0.90963199536?*I, 0.84125353283? + 0.54064081746?*I, -0.65486073395? + 0.75574957436?*I, -0.65486073395? - 0.75574957436?*I, 0.84125353283? - 0.54064081746?*I, 0.41541501300? + 0.90963199536?*I, -0.95949297362? + 0.28173255684?*I, -0.14231483828? - 0.98982144188?*I)
 ], 1)

A similar solution applies to your second problem:

sage: M2=matrix.circulant([1,-1/2*I,0,0,0,0,1/2*I])
sage: EV2_bad=M2.eigenvectors_right()
sage: EV2_bad[5]
(1/12*sqrt(144*(7/1152*I*sqrt(3) - 7/3456)^(1/3) + 7/(7/1152*I*sqrt(3) - 7/3456)^(1/3) + 84) + 1,
 [],
 1)
sage: EV2=M2.change_ring(QQbar).eigenvectors_right()
sage: EV2[5]
(0.2181685175319702?, [
 (1.000000000000000? + 0.?e-15*I, 0.623489801858734? - 0.781831482468030?*I, -0.222520933956314? - 0.974927912181824?*I, -0.900968867902419? - 0.433883739117558?*I, -0.900968867902419? + 0.433883739117558?*I, -0.222520933956315? + 0.974927912181824?*I, 0.623489801858734? + 0.781831482468030?*I)
 ], 1)

HTH,

edit flag offensive delete link more
2

answered 2019-07-30 20:54:47 +0100

rburing gravatar image

I don't know what's going on there either, but at least you can work around it by switching the base ring of your matrices from the symbolic ring SR to the algebraic field QQbar (which is a good idea anyway):

sage: M = matrix.circulant(vector(QQbar, [1,-1/2*I,0,0,0,0,0,0,0,0,1/2*I]))
sage: M.eigenvectors_right()

This gives 11 eigenvectors.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-07-30 17:20:19 +0100

Seen: 2,082 times

Last updated: Jul 30 '19