Apparently I was incorrectly defining x as an integer, however, I did
not get an error the first I tried.

incorrect way: x = PolynomialRing(ZZ)
correct way: g.<x> = PolynomialRing(ZZ)

The len method works now. Thanks.

On 3/26/07, Justin C. Walker <[EMAIL PROTECTED]> wrote:
>
>
> On Mar 26, 2007, at 12:24 , Timothy Clemans wrote:
>
> >
> > I just want to tell the user of my factoring apps when the quadratic
> > that they submit is prime. I've tried is_prime, and
> > len(factor(x^2+B*x+C)) (thinking an answer of one would mean its
> > prime, but it does not mean that). What is the best way in SAGE right
> > now to test a polynomial over ZZ to tell if it is irreducible over ZZ?
>
> I think is_prime() is just for integers.
>
> You should be able to infer that a polynomial is irreducible if factor
> () returns a value with length 1.  Why don't you think that will work?
>
> There may be a few kinks in the strategy, depending on the kind of
> polynomial the user hands you, though.
>
> You can always verify that a quadratic polynomial over ZZ is
> irreducible over ZZ by doing it the hard way: compute the roots; if
> they are both integers, the polynomial is reducible over ZZ; else
> not :-}.
>
> Justin
>
> --
> Justin C. Walker, Curmudgeon at Large
> Institute for the Absorption of Federal Funds
> -----------
> My wife 'n kids 'n dogs are gone,
> I can't get Jesus on the phone,
> But Ol' Milwaukee's Best is my best friend.
> -----------
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to