On Monday, 14 April 2025 at 10:05:20 UTC-7 Georgi Guninski wrote: I continue to think this is at least one bug.
There is an easy fix via change_ring(): sage: M=F.adjacency_matrix();f=M.characteristic_polynomial();f=f.change_ring(AA) ....: ;ro=f.roots();sum(e for _,e in ro) 90 I'm not sure what this fixes. Wouldn't M.characteristic_polynomial().degree() be a faster way of getting that answer? Or is your suggestion to force the spectrum into AA? The routine is documented as applying to both undirected and to digraphs and the latter can have nonreal spectral values. I expect changing it is only going to be cosmetic. Even in printing the result is already unambiguous: given that the characteristic polynomial has rational coefficients, any nonreal root would have to have its imaginary part distinguished from 0 in order to separate it from its conjugate. So +0.?e-60*I must actually be really zero in this context. If you want to know for sure, ask the number; don't rely on an arbitrarily produced string representation. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/sage-devel/a5f81bd0-b500-4225-bff6-0edb3444117bn%40googlegroups.com.