On 1 October 2013 13:46, Ursula Whitcher <whitc...@uwec.edu> 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 brackets and the colon doing?

The argument is a python dict, which you should read up about for more
details.  It's a collection of key:value pairs.  Here the keys are
tuples giveing the vector of exponents and the values are the
coefficients.  In your example there is only one term, the exponent
tuple is [1,1,1] and the coefficient is 1.  You could also write

sage: A({(1,1,1):1})

since the key must be a tuple like (1,1,1) and not a list like [1,1,1]
(these are Python basics).

>
> Also, is there a reason that A.monomial([1,1,1]) does not return the same

You did not make precise what type your A is but if I define

sage: A.<x,y,z> = QQ[]
sage: A
Multivariate Polynomial Ring in x, y, z over Rational Field
sage: type(A)
<type 
'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomialRing_libsingular'>

then A has no method called "monomial".

John Cremona

> result?
>
> --Ursula.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to