ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 24 Nov 2016 21:15:42 +0100comparing sets of roots of charpolyhttps://ask.sagemath.org/question/35729/comparing-sets-of-roots-of-charpoly/ I am missing something about how to compare list of roots.
During a small algorithm I need to know wether a matrix has or not complex eigenvalues. I did the following
A=matrix(QQ,[[1,2,1],[6,-1,0],[-1,-2,-1]])
a=(B.charpoly()).roots(ring= QQ, multiplicities=False)
b=(B.charpoly()).roots(ring= QQbar, multiplicities=False)
then a is the list [-4,0,3] and b is the list [3,0,-4].
I don't get the following :
set(a)==set(b)
return false while
set([-4,0,3])==set([3,0,-4])
return true.
Any help, either on the first pb (knowing that a QQ matrix has complex eigenvalues) or on the second would be greatly appreciated.
Cheers.Laurent BThu, 24 Nov 2016 21:15:42 +0100https://ask.sagemath.org/question/35729/