solved at

https://trac.sagemath.org/ticket/26593

Le 26/10/2018 à 16:48, 'Paul Mercat' via sage-devel a écrit :
Thank you. So the bug is with the test of equality in QQbar, not with
NumberField.
Do you know how to solve this problem with QQbar ?

I tried to look at where is the error, and it looks like there is an
infinite loop:

/Users/mercatp/sage-8.2/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_compiled.pyx
 in sage.rings.polynomial.polynomial_compiled.abc_pd.eval 
(build/cythonized/sage/rings/polynomial/polynomial_compiled.c:6599)()    506     
507     cdef int eval(abc_pd self, object vars, object coeffs) except -2:--> 
508         pd_eval(self.left, vars, coeffs)    509         pd_eval(self.right, 
vars, coeffs)    510         self.value = self.left.value * self.right.value + 
coeffs[self.index]
/Users/mercatp/sage-8.2/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_compiled.pyx
 in sage.rings.polynomial.polynomial_compiled.pd_eval 
(build/cythonized/sage/rings/polynomial/polynomial_compiled.c:3574)()    352 cdef 
inline int pd_eval(generic_pd pd, object vars, object coeffs) except -2:    353    
 if pd.value is None:--> 354         pd.eval(vars, coeffs)    355     pd.hits 
+= 1    356


But I don't know how to avoid this loop, because I don't know what do this
code...

Paul

Le vendredi 26 octobre 2018 16:04:57 UTC+2, John Cremona a écrit :



On Fri, 26 Oct 2018 at 13:07, 'Paul Mercat' via sage-devel <
sage-...@googlegroups.com <javascript:>> wrote:

Hi !

I have a strange bug with NumberField: when I do

sage: pi = x^7 - 2*x^6 + x^3 - 2*x^2 + 2*x - 1
sage: b = pi.roots(ring=QQbar)[3][0]
sage: pi = b.minpoly()
sage: K = NumberField(pi, 'b', embedding=b)

it works well. But if I execute it a second time, then it never
terminates!
Do you have a explanation and a correction to this problem ?


How strange.  The first 3 lines are fine the second time.  So is the
number field construction when you leave out the embedding.

When a number field is constructed it is cached so that a new construction
returns the same object, and not a copy, where possible.  In your case that
means checking that the embeddings are the same, which means checking that
two elements of QQbar are the same.  That can be expensive.

If you do
b1 = pi.roots(ring=QQbar)[3][0]
b2 = pi.roots(ring=QQbar)[3][0]

and then

b1==b2

it also takes ages.  I cannot remember the algorithm here but it does not
look optimal;   it may be working effectively in a field of degree 7*6 or
possibly 7!.  I note that

d=b1-b2
d==0

yields True immediately.

John

Thank,
Paul


--
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+...@googlegroups.com <javascript:>.
To post to this group, send email to sage-...@googlegroups.com
<javascript:>.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.




--
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to