On Sep 7, 10:47 am, tvn <[email protected]> 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> ?

Does this do what you want?  (I'm not exactly sure what you're looking
for.)

sage: l = ['a','b','c','d']
sage: R = PolynomialRing(CC, l)
sage: R.inject_variables()
sage: type(a)
<class
'sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict'>

--
John

-- 
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