You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Sage 8.4 on ubuntu, in some cases, two equal polynomials -- one returned by a cached function and the one returned by a direct call -- give different results when you call .cyclotomic_part() on them. Unfortunately it's nondeterministic, and so it could have nothing to do with the function itself. I think it happens after an ill-fated interrupt.
Starting from
c = cached_function(lambda p,q: cyclotomic_polynomial(p).subs(cyclotomic_polynomial(q)))
I've seen this happen several times now-- earlier, in a different session, it happened at (3, 1103). If I use dumps to save the objects and then load them into a separate session, the problem doesn't carry over.
So since it's clearly stateful in some way, I wondered if it has to do with what happens if you use control-C to interrupt a process at an inopportune moment, and indeed, if I run
cc = cached_function(lambda p,q: cyclotomic_polynomial(p).subs(cyclotomic_polynomial(q)))
to create a new function, and then run the following repeatedly, hitting control-C each time:
for i in range(1, 2000):
print(i)
assert cc(3, i).has_cyclotomic_factor() == (cc(3, i).cyclotomic_part() != 1)
I eventually see something like
87
88
89
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-5-40435234e9d7> in <module>()
1 for i in range(Integer(1), Integer(2000)):
2 print(i)
----> 3 assert cc(Integer(3), i).has_cyclotomic_factor() == (cc(Integer(3), i).cyclotomic_part() != Integer(1))
4
AssertionError:
sage: i
89
sage: cc(3, i) == cyclotomic_polynomial(3).subs(cyclotomic_polynomial(i))
True
sage: cc(3, i).cyclotomic_part()
1
sage: cyclotomic_polynomial(3).subs(cyclotomic_polynomial(i)).cyclotomic_part()
x^2 - x + 1
This is suboptimal. :-)
(I wasn't sure what component to use: please edit to whatever makes sense.)
There are several possibly related tickets involving alarms, e.g. #24986, which aren't encouraging.
Unfortunately when I was trying to automate the tests I hit
sage: alarm(3)
sage:
AlarmInterrupt escaped interact()
sage:
sage:
^[[26;1R
**********************************************************************
Oops, Sage crashed. We do our best to make it stable, but...
In Sage 8.4 on ubuntu, in some cases, two equal polynomials -- one returned by a cached function and the one returned by a direct call -- give different results when you call
.cyclotomic_part()
on them. Unfortunately it's nondeterministic, and so it could have nothing to do with the function itself. I think it happens after an ill-fated interrupt.Starting from
I eventually got into a state where
I've seen this happen several times now-- earlier, in a different session, it happened at (3, 1103). If I use
dumps
to save the objects and then load them into a separate session, the problem doesn't carry over.So since it's clearly stateful in some way, I wondered if it has to do with what happens if you use control-C to interrupt a process at an inopportune moment, and indeed, if I run
to create a new function, and then run the following repeatedly, hitting control-C each time:
I eventually see something like
This is suboptimal. :-)
(I wasn't sure what component to use: please edit to whatever makes sense.)
Component: misc
Issue created by migration from https://trac.sagemath.org/ticket/26788
The text was updated successfully, but these errors were encountered: