Opened 7 years ago
Last modified 4 years ago
#12236 new defect
random element madness
Reported by: | mariah | Owned by: | AlexGhitza |
---|---|---|---|
Priority: | minor | Milestone: | sage-6.4 |
Component: | basic arithmetic | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: | todo |
Description
The following output is generated by the code below using sage-4.7.2:
R: Univariate Quotient Polynomial Ring in xbar over Ring of integers modulo 2 with modulus x^4 + 1 S: Quotient of Univariate Quotient Polynomial Ring in xbar over Integer Ring with modulus x^4 + 1 by the ideal (2) Now these two rings are isomorphic, but constructed in different orders, so it is not that surprising that SAGE considers them to be different: R == S: False And random_element on R seems sensible: [xbar^3 + xbar + 1, xbar^3 + xbar^2 + 1, xbar^2 + xbar, xbar^2, 1, xbar^2 + xbar, xbar^3, xbar^3, xbar^3 + xbar^2, xbar^2 + xbar + 1] But random_element on S just doesn't make sense on several levels: [2, 1, -2, 2, 2, 0, 1, 0, 2, -2] 1) Why are there no polynomial powers? 2) Why are the integers not reduced modulo 2?
Here is the code:
def print_random_elements(R, num_elts=10): R_elts = [R.random_element() for i in range(num_elts)] print R_elts def madness(): U.<x> = ZZ[] f = x^4 + 1 p = 2 num_elts = 10 S = U.quotient(f).quotient(p) #S.<x> = Integers(p)[] #S1 = S.quotient(f) R = (Integers(p)['x']).quotient(f) print 'R:', R print 'S:', S print '''Now these two rings are isomorphic, but constructed in different orders, so it is not that surprising that SAGE considers them to be different:''' print "R == S:", R == S print 'And random_element on R seems sensible:' print_random_elements(R) print "But random_element on S just doesn't make sense on several levels:" print_random_elements(S) print "1) Why are there no polynomial powers?" print "2) Why are the integers not reduced modulo %s?" % p madness()
Change History (8)
comment:1 Changed 7 years ago by
- Owner changed from AlexGhitza to swenson
comment:2 Changed 7 years ago by
- Owner changed from swenson to AlexGhitza
Sorry -- didn't mean to steal this from AlexGhitza?
comment:3 Changed 7 years ago by
I think that, at least for now, we should just throw an error if you try to quotient out a polynomial ring by an ideal of the base ring since you get a "broken" object.
comment:4 Changed 6 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:5 Changed 5 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:6 Changed 5 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:7 Changed 5 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:8 Changed 4 years ago by
- Stopgaps set to todo
Note: See
TracTickets for help on using
tickets.
I have a patch to address some of this that I will post as soon as I can, but there are two issues here, which are identified above.
Issue 1 is a "feature" of QuotientRing_generic that I am still getting to the bottom of, but notice, here
This appears to be related to the following error:
i.e., polynomial rings seem to expect that, if you mod out by an ideal, it should be a polynomial, which isn't the case if you are trying to mod out by an ideal in the base ring.
This seems to raise other issues with integer ideals interacting with polynomials rings, e.g.,
:(
Issue 2 raised above has to do with ideal.reduce(): the default implementation is being called, which just gives a pass-through, i.e.,
At the very least, this should be coercing its argument into its base ring.