#12236: random element madness
--------------------------------+-------------------------------------------
   Reporter:  mariah            |          Owner:  AlexGhitza
       Type:  defect            |         Status:  new       
   Priority:  minor             |      Milestone:  sage-4.8  
  Component:  basic arithmetic  |       Keywords:            
Work_issues:                    |       Upstream:  N/A       
   Reviewer:                    |         Author:            
     Merged:                    |   Dependencies:            
--------------------------------+-------------------------------------------
 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()
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12236>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to