# Revision history [back]

### How to stop Sage from finding erroneous complex roots?

Consider the matrix,

A = matrix ( [0,1,w^a,1],[1,0,1,w^(k-b)],[w^(k-a),1,0,w^(k-c)],[1,w^b,w^c,0])

where w is the m^th of the k^th roots of unity, w = expw = exp((2piI*m )/k) for some k a positive integer, and 1 <= m <= (k-1) and 1<= a,b,c <= (k-1)

Then the characteristic polynomial of the above matrix is, p(x) = x^4 - 6*x^2 -x *(w^(a-c) + w^(c-a) + w^b + w^(-b) + w^(b-c) + w^(c-b) + w^a + w^(-a)) + (3 -w^c - w^(-c) - w^(a+b-c) - w^(-a-b+c) - w^(a-b) - w^(-a+b) )

• Is there a way to get sage to be able to calculate the above?

Now I try getting roots of the above by doing, g(x)=real_part(p(x)).simplify() g.solve(x)

• Now Sage seems to be generically detecting complex eigenvalues as roots of g! This can't happen since its a characteristic polynomial of a Hermitian matrix!

How to get across this trouble?

### How to stop Sage from finding erroneous complex roots?

Consider the matrix,

A = matrix ( [0,1,w^a,1],[1,0,1,w^(k-b)],[w^(k-a),1,0,w^(k-c)],[1,w^b,w^c,0])

where w is the m^th of the k^th roots of unity, w = expw = exp((2piI*m )/k) for some k a positive integer, and 1 <= m <= (k-1) and 1<= a,b,c <= (k-1)

Then the characteristic polynomial of the above matrix is, p(x) = x^4 - 6*x^2 -x *(w^(a-c) + w^(c-a) + w^b + w^(-b) + w^(b-c) + w^(c-b) + w^a + w^(-a)) + (3 -w^c - w^(-c) - w^(a+b-c) - w^(-a-b+c) - w^(a-b) - w^(-a+b) )

• Is there a way to get sage to be able to calculate the above?

Now I try getting roots of the above by doing, g(x)=real_part(p(x)).simplify() g.solve(x)

• Now Sage seems to be generically detecting complex eigenvalues as roots of g! This can't happen since its a characteristic polynomial of a Hermitian matrix!

How to get across this trouble?

### How to stop Sage from finding erroneous complex roots?

Consider the matrix,

A = matrix ( [0,1,w^a,1],[1,0,1,w^(k-b)],[w^(k-a),1,0,w^(k-c)],[1,w^b,w^c,0])

where w is the m^th of the k^th roots of unity, w = exp((2piI*m )/k) for some k a positive integer, and 1 <= m <= (k-1) and 1<= a,b,c <= (k-1)

Then the characteristic polynomial of the above matrix is, p(x) = x^4 - 6*x^2 -x *(w^(a-c) + w^(c-a) + w^b + w^(-b) + w^(b-c) + w^(c-b) + w^a + w^(-a)) + (3 -w^c - w^(-c) - w^(a+b-c) - w^(-a-b+c) - w^(a-b) - w^(-a+b) )

• Is there a way to get sage to be able to calculate the above? above characteristic polynomial?

Now I try getting roots of the above by doing, doing,

              g(x)=real_part(p(x)).simplify()
g.solve(x)
g.solve(x)

• Now Sage seems to be generically detecting complex eigenvalues as roots of g! (I tried on say k=6, m=a=b=c=1) This can't happen since its a characteristic polynomial of a Hermitian matrix!

How to get across this trouble? 4 No.4 Revision

### How to stop Sage from finding erroneous complex roots?

Consider the matrix,

A = matrix ( [0,1,w^a,1],[1,0,1,w^(k-b)],[w^(k-a),1,0,w^(k-c)],[1,w^b,w^c,0]) [0,1,w^a,1],[1,0,1,w^(k-b)],[w^(k-a),1,0,w^(k-c)],[1,w^b,w^c,0])


where w is the m^th of the k^th roots of unity, w = exp((2piI*m )/k) exp((2*pi*I*m )/k for some k a positive integer, and 1 <= m <= (k-1) and 1<= a,b,c <= (k-1)

Then the characteristic polynomial of the above matrix is, p(x) = x^4 - 6*x^2 -x *(w^(a-c) + w^(c-a) + w^b + w^(-b) + w^(b-c) + w^(c-b) + w^a + w^(-a)) + (3 -w^c - w^(-c) - w^(a+b-c) - w^(-a-b+c) - w^(a-b) - w^(-a+b) )

• Is there a way to get sage to be able to calculate the above characteristic polynomial?

Now I try getting roots of the above by doing,

 g(x)=real_part(p(x)).simplify()
g.solve(x)

• Now Sage seems to be generically detecting complex eigenvalues as roots of g! (I tried on say k=6, m=a=b=c=1) This can't happen since its a characteristic polynomial of a Hermitian matrix!

How to get across this trouble? 5 retagged

### How to stop Sage from finding erroneous complex roots?

Consider the matrix,

A = matrix ( [0,1,w^a,1],[1,0,1,w^(k-b)],[w^(k-a),1,0,w^(k-c)],[1,w^b,w^c,0])


where w is the m^th of the k^th roots of unity, w = exp((2*pi*I*m )/k for some k a positive integer, and 1 <= m <= (k-1) and 1<= a,b,c <= (k-1)

Then the characteristic polynomial of the above matrix is, p(x) = x^4 - 6*x^2 -x *(w^(a-c) + w^(c-a) + w^b + w^(-b) + w^(b-c) + w^(c-b) + w^a + w^(-a)) + (3 -w^c - w^(-c) - w^(a+b-c) - w^(-a-b+c) - w^(a-b) - w^(-a+b) )

• Is there a way to get sage to be able to calculate the above characteristic polynomial?

Now I try getting roots of the above by doing,

g(x)=real_part(p(x)).simplify()
g.solve(x)

• Now Sage seems to be generically detecting complex eigenvalues as roots of g! (I tried on say k=6, m=a=b=c=1) This can't happen since its a characteristic polynomial of a Hermitian matrix!

How to get across this trouble? 6 retagged FrédéricC 2869 ●3 ●31 ●58

### How to stop Sage from finding erroneous complex roots?

Consider the matrix,

A = matrix ( [0,1,w^a,1],[1,0,1,w^(k-b)],[w^(k-a),1,0,w^(k-c)],[1,w^b,w^c,0])


where w is the m^th of the k^th roots of unity, w = exp((2*pi*I*m )/k for some k a positive integer, and 1 <= m <= (k-1) and 1<= a,b,c <= (k-1)

Then the characteristic polynomial of the above matrix is, p(x) = x^4 - 6*x^2 -x *(w^(a-c) + w^(c-a) + w^b + w^(-b) + w^(b-c) + w^(c-b) + w^a + w^(-a)) + (3 -w^c - w^(-c) - w^(a+b-c) - w^(-a-b+c) - w^(a-b) - w^(-a+b) )

• Is there a way to get sage to be able to calculate the above characteristic polynomial?

Now I try getting roots of the above by doing,

g(x)=real_part(p(x)).simplify()
g.solve(x)

• Now Sage seems to be generically detecting complex eigenvalues as roots of g! (I tried on say k=6, m=a=b=c=1) This can't happen since its a characteristic polynomial of a Hermitian matrix!

How to get across this trouble?