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

Re: [sage-support] Re: Cython, what to import

2013-10-01 Thread Jori Mantysalo
On Tue, 1 Oct 2013, Volker Braun wrote: For example: sage: import_statements(save) from sage.structure.sage_object import save Thanks for very fast answer! This works, but import_statements(Posets) says ** Warning **: several names for that object: Posets, posets from sage.combinat.poset

[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

[sage-support] Re: Cython, what to import

2013-10-01 Thread Volker Braun
For example: sage: import_statements(save) from sage.structure.sage_object import save On Tuesday, October 1, 2013 10:07:48 AM UTC+1, jori.ma...@uta.fi wrote: > > I would like to precalculate something and use cython for that. For > example: > > N=7 > L = [ P for P in Posets(N) if min([len(P.

[sage-support] Cython, what to import

2013-10-01 Thread Jori Mantysalo
I would like to precalculate something and use cython for that. For example: N=7 L = [ P for P in Posets(N) if min([len(P.lower_covers(a)) for a in P.maximal_elements()]) >= 4 ] save(L, '/some/where/L') (Then later I can load 'L' and do some calculations with those posets --- no need to (re)c