#20756: sign is slow (if not wrong) for number field elements
-------------------------------------+-------------------------------------
       Reporter:  vdelecroix         |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-7.3
      Component:  number fields      |   Resolution:
       Keywords:  days74             |    Merged in:
        Authors:  Vincent Delecroix  |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/vdelecroix/20756                 |  31e8874e03c35a6e1f9f0076d8fe7f2937d0177b
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Description changed by vdelecroix:

Old description:

> {{{
> sage: R.<x> = ZZ[]
> sage: p = R.random_element(degree=20) + x**21
> sage: r = p.roots(AA, False)
> sage: K.<a> = NumberField(p, embedding=r[0])
> sage: %time sign(a)
> CPU times: user 1.34 s, sys: 0 ns, total: 1.34 s
> Wall time: 1.33 s
> -1
> sage: b = continued_fraction(a).convergent(20) - a
> sage: sign(b)
> sgn(3^(1/100) - 179093512558/177136737587)
> sage: %time sign(b)
> CPU times: user 8.35 s, sys: 20 ms, total: 8.37 s
> Wall time: 8.32 s
> sgn(3^(1/100) - 179093512558/177136737587)
> }}}

New description:

 {{{
 sage: x = polygen(ZZ)
 sage: K.<a> = NumberField(x^100 - 3, embedding=AA(3)**(1/100))
 sage: %time sign(a)
 CPU times: user 1.34 s, sys: 0 ns, total: 1.34 s
 Wall time: 1.33 s
 1
 sage: b = continued_fraction(a).convergent(20) - a
 sage: sign(b)
 sgn(-1/1495877943276*(1/4)^(1/5)*(-(sqrt(5) - I*sqrt(-2*sqrt(5) + 10) +
 1)*(-3^(1/4))^(1/5))^(1/5)*(373969485819*sqrt(5) -
 373969485819*I*sqrt(-2*sqrt(5) + 10) + 373969485819) +
 378100611523/373969485819)
 }}}
 With the branch applied
 {{{
 sage: %time sign(a)
 CPU times: user 4 ms, sys: 0 ns, total: 4 ms
 Wall time: 4.65 ms
 1
 sage: b = continued_fraction(a).convergent(20) - a
 sage: %time sign(b)
 CPU times: user 4 ms, sys: 0 ns, total: 4 ms
 Wall time: 6.02 ms
 -1
 }}}

--

--
Ticket URL: <http://trac.sagemath.org/ticket/20756#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to