I'm new to sage and was introduced to it this semester in my Cryptography course as being a python friendly alternative to Pari/GP. So playing around with it I was factoring polynomials over GF(2) and trying to make a quick function to generate random polynomials and return if they were reducible, without me actually visually inspecting the factorization. For the sake of giving an example I'll just define a couple of polynomials:

sage: R.<x> = PolynomialRing(GF(2))
sage: p = x^30 + x^21 + 1
sage: q = x^30 + x^14 + 1
sage: fac_p = factor(p); fac_p
x^30 + x^21 + 1
sage: fac_q = factor(q); fac_q
(x^15 + x^7 + 1)^2

Now here is the interesting bit:

sage: fac_q == q # should return False
False
sage: fac_p == p # would expect True
False

What!? But p is irreducible, its factorization should be itself. After much digging around and thinking about things from a programmers perspective rather than a mathematics perspective the idea that factorizations are lists of factors and why comparing a factorization to a polynomial doesn't work. However, I would contend that the comparison does in fact make intuitive sense. So, perhaps comparison testing for Factorizations and Polynomials should be a bit more "intelligent" or at least provide some easy way of comparing them in the intuitive sense of compare. After all this does work:

sage: fac_p[0][0] == p
True

And that would only hold true (as far as I know) if the polynomial was irreducible.

--
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-support
URL: http://www.sagemath.org

Reply via email to