On Tuesday, 15 April 2025 at 03:48:25 UTC-7 Georgi Guninski wrote: Just trying to show that real roots can be easily computed, not relying on the bugs in roots over QQbar. I don't see way to control the precision in the spectrum.
The trick with QQbar: there IS no precision to control. The system is actually computing with exact algebraic numbers. It's using floating point approximations for efficiency, but it's making sure it's doing so with enough precision to separate conjugates (apart from bugs that are undoubtedly still there). If you want floating point approximations to the spectrum then ask for the roots of the characteristic polynomial in a floating point field (RealField or ComplexField). Who decides that small algebraic number is real, is it user's responsibility, discarding visual non-zero? No you ask the system: sage: R.<x>=QQ[] sage: rts=f.roots(QQbar, multiplicities=False) sage: a=rts[1]+rts[2] sage: a -1.000000000000000? + 0.?e-19*I sage: a.imag() == 0 True sage: a -1 Checking equality in QQbar can be very expensive so the system avoids it when possible. Just bear in mind that the printing of an element of QQbar doesn't fully tell its identity. A floating point approximation never will. The question marks in the representation give a hint to that already. Note that AA was bolted onto QQbar at a later stage. Root finding over AA is currently probably implemented by root finding over QQbar and then seeing which roots lie in AA. In principle it's possible to not do it that way but I doubt that you'd get much gain from it. -- 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/5967d529-0d3c-4690-8dd0-0fa8aad12f4bn%40googlegroups.com.