Then making it Expression.laurent_polynomial() but allowing polynomial with ring=LaurentPolyRing as argument seems to be the best interface.
On Wed, May 11, 2016, 22:26 Nils Bruin <nbr...@sfu.ca> wrote: > On Tuesday, May 10, 2016 at 10:55:20 PM UTC-7, Ralf Stephan wrote: >> >> On Tuesday, May 10, 2016 at 10:48:10 PM UTC+2, mmarco wrote: >>> >>> Thanks for the answer. So you propose that Expression.polynomial() >>> should return either a polynomial or a laurent polynomial depending on the >>> expression? >>> >> >> Depending on expression and ring argument: >> > > > I think people missed the double definition of `x`, particularly because > the reassignment of `x` gets hidden by doing in the RHS of an assignment. > To be clearer: > > >> >> sage: R = PolynomialRing(QQ,'x') #to avoid confusion about what x is >> sage: S = LaurentPolynomialRing(QQ, 'y') >> sage: var('x,y,z') >> > sage: parent((z).polynomial(QQ)) >> Univariate Polynomial Ring in z over Rational Field >> sage: parent((1/z+z).polynomial(QQ)) >> Univariate Laurent Polynomial Ring in z over Rational Field >> > > I would say this is an error, because 1/z+z is not a polynomial over QQ in > most normal senses of the word. Where would you stop? what would > > (1/(z+1) + z).polynomial(QQ) > > do? Will that return an answer in QQ[z,U]/((z+1)*U-1) ? > > I know that in symbolics you have to read off return types from properties > of the input, not just from its type, but I think this going a little too > far. "SR.polynomial(...)" should return polynomials in variables that are > algebraically independent over the base ring. So no laurent polynomials. > > -- > You received this message because you are subscribed to a topic in the > Google Groups "sage-devel" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sage-devel/WjH8mbsDg2Y/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.