[sage-devel] Re: f in ZZ[x] mod p gives ZZ[x]

2009-04-24 Thread William Stein

On Fri, Apr 24, 2009 at 9:03 AM, Robert Miller rlmills...@gmail.com wrote:

 sage: x = polygen(ZZ)
 sage: f = 2*x^2
 sage: f.mod(2)==0
 False

You should do f.mod? and read the docstring, which says:

Return a representative for self modulo the ideal I (or the ideal
  generated by the elements of I if I is not an ideal.)

I believe f itself is a representative for f mod the ideal 2.  :-)

You're assuming that the mod function does something interesting, but
it is in this case just some generic code which does what its
definition says, which in this case happens to be nothing.

So make it better! :-)

William


 sage: type(f.mod(2))
 type
 'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint'

 Even this doesn't work:
 sage: R.x = ZZ[]
 sage: f.mod(2*R)==0
 False

 But last I checked, 2 | 2x^2.
 




-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: f in ZZ[x] mod p gives ZZ[x]

2009-04-24 Thread Robert Miller

Worse still:

sage: x = polygen(QQ)
sage: h = 4*x
sage: h%3
0


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: f in ZZ[x] mod p gives ZZ[x]

2009-04-24 Thread Craig Citro

 Worse still:

 sage: x = polygen(QQ)
 sage: h = 4*x
 sage: h%3
 0


Over QQ[x], isn't 4*x = 3 * (4/3*x) ? Over ZZ, it's fine:

sage: x = polygen(ZZ)
sage: h = 4*x
sage: h%3
x

-cc

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: f in ZZ[x] mod p gives ZZ[x]

2009-04-24 Thread Robert Miller

Yeah, I should have mentioned that my point was that maybe h%3 should
raise an error over QQ.

On Apr 24, 11:00 am, Craig Citro craigci...@gmail.com wrote:
  Worse still:

  sage: x = polygen(QQ)
  sage: h = 4*x
  sage: h%3
  0

 Over QQ[x], isn't 4*x = 3 * (4/3*x) ? Over ZZ, it's fine:

 sage: x = polygen(ZZ)
 sage: h = 4*x
 sage: h%3
 x

 -cc
--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: f in ZZ[x] mod p gives ZZ[x]

2009-04-24 Thread William Stein

On Fri, Apr 24, 2009 at 11:53 AM, Robert Miller rlmills...@gmail.com wrote:

 Yeah, I should have mentioned that my point was that maybe h%3 should
 raise an error over QQ.


Over QQ, the number 3 generates the unit ideal, so everything is 0
modulo it :-).

William

 On Apr 24, 11:00 am, Craig Citro craigci...@gmail.com wrote:
  Worse still:

  sage: x = polygen(QQ)
  sage: h = 4*x
  sage: h%3
  0

 Over QQ[x], isn't 4*x = 3 * (4/3*x) ? Over ZZ, it's fine:

 sage: x = polygen(ZZ)
 sage: h = 4*x
 sage: h%3
 x

 -cc
 




-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---