On Tue, May 12, 2009 at 7:56 AM, Florent Hivert
<[email protected]> wrote:
>
> Dear William,
>
>> FreeAlgebraElement was written in 2005, and nobody has worked on it since.
>> Maybe now it is your turn.
>
> 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
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.
> 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.
William
--~--~---------~--~----~------------~-------~--~----~
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-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---