id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
12236 random element madness mariah AlexGhitza "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. = ZZ[]
f = x^4 + 1
p = 2
num_elts = 10
S = U.quotient(f).quotient(p)
#S. = 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()
}}}" defect new minor sage-6.4 basic arithmetic N/A todo