On 9/7/10 12:47 PM, tvn wrote:
Hi, given a list of variable names as strings (e.g.,  l =
['a','b','c','d'])  I try to make those become variables in a
Polynomial Ring.  One way is to do something like
R.<a,b,c,d>=CC['a','b','c','d'] ,  after this the type of a or b or c
or d is<class
'sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict'>  .

How can I do this in a more automatic way  that can take in the list l
and do the same thing as above (e.g., make a,b,c,d of type<class
'sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict'>)
without having to manually type  R.<a,b,c,d>  ?

Thanks  in advance


Something like this?

sage: R=CC[','.join('x{0}'.format(i) for i in range(20))]
sage: R.inject_variables()
Defining x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19
sage: type(x0)
<class 'sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict'>


Jason

--
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-support
URL: http://www.sagemath.org

Reply via email to