Dear William, > > Or my student's :). That was my intention ! The obvious question is now the > > naming convention. It seems to me that we should stick as close as possible > > to > > polynomials: > > > > sage: ring = ZZ['x1,x2'] > > sage: x1 = ring.gens()[0] # why x1 is not defined ??? > > What do you mean by "why x1 is not defined?" There is inject_on(), > but that only works with PolynomialRing: > > sage: inject_on() > Redefining: FiniteField Frac FractionField FreeMonoid GF > LaurentSeriesRing NumberField PolynomialRing quo quotient
Ok !!! In forgot about this mantra. Thanks for pointing this out. > sage: PolynomialRing(ZZ, 'x1,x2') > Defining x1, x2 > Multivariate Polynomial Ring in x1, x2 over Integer Ring > sage: (x1+x2)^3 > x1^3 + 3*x1^2*x2 + 3*x1*x2^2 + x2^3 > > > It might be possible to fix ZZ['x1,x2'] to also work with inject_on -- not > sure. And I also thought after asking the debugger that the call PolynomialRing(ZZ, 'x1,x2') and ZZ['x1,x2'] where strictly equivalent: sage: trace("ZZ['x,y']") > <string>(1)<module>() ipdb> s --Call-- > /usr/local/sage/sage-3.4.2/local/lib/python2.5/site-packages/sage/rings/polynomial/polynomial_ring_constructor.py(41)PolynomialRing() 40 ---> 41 def PolynomialRing(base_ring, arg1=None, arg2=None, 42 sparse=False, order='degrevlex', But inject_on seems to change the first one without telling the second one... > > sage: truc = x1^8 + 2*x1^4 + 2 > > sage: truc > > x1^8 + 2*x1^4 + 2 > > sage: type(truc) > > <type > > 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'> > > sage: truc.dict() > > {(0, 0): 2, (4, 0): 2, (8, 0): 1} > > sage: truc.coefficients() > > [1, 2, 2] > > sage: truc.monomials() > > [x1^8, x1^4, 1] > > > > Should we stick to this interface ? > > > > I've cc'd David Kohel -- original author of FreeAlgebra, since he > might have some thoughts. Awaiting for comments... Cheers, Florent --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---