On Wed, 17 Sep 2014 17:59:49 +0200 Jonas Jermann <jjerma...@gmail.com> wrote:
> On 17.09.2014 17:29, Marc Mezzarobba wrote: > > Jonas Jermann wrote: > >> What would you suggest I do to get a fast exact sign/comparison? > > > > Just a wild guess, but you may want to see if the patch at > > > > http://trac.sagemath.org/ticket/15600 > > > > helps. > > It doesn't (also note that the polynomials here have deg=4 < 8). "the polynomials"? sage: el2 = (791264*AA(2*cos(pi/8))^2 - 463492).sqrt() sage: el2._exact_value() [ something horrible involving a polynomial of degree 16 ] This is pretty fast though: sage: x = var('x') sage: el1 = AA((x^4 - 2238072*x^2 + 44133904).roots()[1][0]) sage: el3 = (791264*AA(2*cos(pi/8))^2 - 463492) sage: el1 > 0 True sage: el3 > 0 True sage: el1^2 == el3 True Perhaps there is a way around the sqrt in your algorithm? Actually this is interesting: sage: el3 = (791264*AA(2*cos(pi/8))^2 - 463492) sage: el2 = el3.sqrt() sage: el2._descr Root 1496.012125692029503? of x^2 - 2.238052280217585?e6 sage: el2.exactify() sage: el2._descr [ that horrible thing ] So in this case the old description would give a much more efficient comparison. Unfortunately, it's discarded... Regards, Erik Massop -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.