Re: [sage-support] converting integer vectors to monomials

2013-10-01 Thread John Cremona
I would have thought that A.monomial(L) where L is either a listor tuple of the right length would be a very natural thing to add for multivariate polynomial rings. You could define your own as a work-around: sage: def monomial(A,L): return A({tuple(L): A.base_ring().one_element()}) sage: mo

Re: [sage-support] converting integer vectors to monomials

2013-10-01 Thread Ursula Whitcher
On 10/1/2013 8:51 AM, John Cremona wrote: Can somebody explain this syntax to me? I understand tuple([1,1,1]), but what are the curly brackets and the colon doing? The argument is a python dict, which you should read up about for more details. Thanks, that's exactly what I needed to know!

Re: [sage-support] converting integer vectors to monomials

2013-10-01 Thread John Cremona
On 1 October 2013 13:46, Ursula Whitcher wrote: > I recently learned that if A is a polynomial ring in Sage in variables x, y, > and z, the command > > A({tuple([1,1,1]):1}) > > returns x*y*z. > > Can somebody explain this syntax to me? I understand tuple([1,1,1]), but > what are the curly bracke

[sage-support] converting integer vectors to monomials

2013-10-01 Thread Ursula Whitcher
I recently learned that if A is a polynomial ring in Sage in variables x, y, and z, the command A({tuple([1,1,1]):1}) returns x*y*z. Can somebody explain this syntax to me? I understand tuple([1,1,1]), but what are the curly brackets and the colon doing? Also, is there a reason that A.monomi