Robert,

Okay, I see the difference: a polynomial generator "over" the ring
means something that will generate a ring over the given ring, not a
polynomial generator "of" the ring.

thanks
john perry

On Dec 6, 12:31 pm, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> I think you are misinterpreting polygen. Polygen takes as input a  
> ring, and creates a new polynomial ring over that rings, and returns  
> the generator of that new ring (not the generator of the original  
> ring). Also, since you didn't provide a name to the polygen function,  
> it defaults to "x."
>
> Rather than type, the parent() function is often more informative.
>
> sage: R = GF(101)['y']
> sage: y = polygen(R)
> sage: parent(y)
> Univariate Polynomial Ring in x over Univariate Polynomial Ring in y  
> over Finite Field of size 101
> sage: y
> x
>
> Type polygen? to see the documentation.
>
> - Robert
>
> On Dec 6, 2008, at 8:08 AM, john_perry_usm wrote:
>
>
>
> > Sorry, I didn't expect that. Here are two examples:
>
> > sage: R = GF(101)['y']
> > sage: y = polygen(R)
> > sage: type(y)
> >    <type
> > 'sage.rings.polynomial.polynomial_element.Polynomial_generic_dense'>
> > sage: y^3/y^2
> >    x^3/x^2
> > sage: simplify(y^3/y^2)
> >    x^3/x^2
> > sage: R.inject_variables()
> >    Defining y
> > sage: type(y)
> >    <type
> > 'sage.rings.polynomial.polynomial_modn_dense_ntl.Polynomial_dense_mod_
> > p'\
>
> > sage: y^3/y^2
> >    y
>
> > This is what the student did:
> > sage: R = PolynomialRing(QQ,'x')
> > sage: x = polygen(R)
> > sage: type(x)
> >    <type
> > 'sage.rings.polynomial.polynomial_element.Polynomial_generic_dense'>
> > sage: x^3/x^2
> >    x^3/x^2
> > sage: R.inject_variables()
> >    Defining x
> > sage: x^3/x^2
> >    x
>
> > Let me know if you need more info.
>
> > john
>
> > On Dec 5, 6:53 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
> >> On Fri, Dec 5, 2008 at 4:31 PM, john_perry_usm  
> >> <[EMAIL PROTECTED]> wrote:
>
> >>> Hi,
>
> >>> x = polygen(<ring>) returns an object of type
> >>> Polynomial_generic_dense, while <ring>.inject_variables() injects  
> >>> x of
> >>> type Polynomial_rational_dense.
>
> >>> Why the difference?
>
> >> Since I see no difference at all with the same ring, can you
> >> make your question more precise?  Thanks:
>
> >> sage: type(polygen(QQ))
> >> <class  
> >> 'sage.rings.polynomial.polynomial_element_generic.Polynomial_rational
> >> _dense'>
> >> sage: QQ['x'].inject_variables()
> >> Defining x
> >> sage: type(x)
> >> <class  
> >> 'sage.rings.polynomial.polynomial_element_generic.Polynomial_rational
> >> _dense'>
> >> sage:
>
> >>> This was a problem for a student today, who was using polygen(),  
> >>> whose
> >>> returnee will not simplify x^3/x^2, whereas inject_variables() did.
>
> >>> regards
> >>> john perry
>
> >> --
> >> William Stein
> >> Associate Professor of Mathematics
> >> University of Washingtonhttp://wstein.org
--~--~---------~--~----~------------~-------~--~----~
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://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to