[sage-support] Re: Define polynomial rings of given variables

2011-12-05 Thread Nils Bruin
R=BooleanPolynomialRing(100,['x'+str(i) for i in [1..100]])
R.inject_variables()# if you don't really need the identifiers in
Python's namespace, better skip this

On Dec 5, 6:18 am, Subhadeep Banik monsieurlel...@gmail.com wrote:
 If I have a boolean  expression of a certain number of variables, how
 do I define a polynomial ring with them.. For example, let
 (x0,x1,x2,x3,x4,x5,x6,x7) be a set of variables, and I have  an
 expression S = x0 + x1*x3 + x7
 I need to define the polynomial ring
 R.x0,x1,x3,x7=BooleanPolynomialRing(4)

 This exercise is fine, if the number of variables is small , but what
 is the solution if the number of variables is large.

 Thank You

 Subhadeep Banik
 
 Senior Research Fellow
 Applied Statistics Unit
 Indian Statistical Institute Kolkata
 Phone : 91 9433037829 (M)
             91 33 - 25741829 (H)

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Define polynomial rings of given variables

2011-12-05 Thread achrzesz


On Dec 5, 3:18 pm, Subhadeep Banik monsieurlel...@gmail.com wrote:
 If I have a boolean  expression of a certain number of variables, how
 do I define a polynomial ring with them.. For example, let
 (x0,x1,x2,x3,x4,x5,x6,x7) be a set of variables, and I have  an
 expression S = x0 + x1*x3 + x7
 I need to define the polynomial ring
 R.x0,x1,x3,x7=BooleanPolynomialRing(4)

 This exercise is fine, if the number of variables is small , but what
 is the solution if the number of variables is large.

 Thank You

 Subhadeep Banik


If you need a polynomial ring with selected variables
then you can try for example

R=PolynomialRing(GF(2),'x',2^8)
x=R.gens()
S=x[253]+x[254]*x[255]
xx=S.variables()
l=len(xx)
P=BooleanPolynomialRing(l,map(str,xx))

Andrzej Chrzeszczyk



 
 Senior Research Fellow
 Applied Statistics Unit
 Indian Statistical Institute Kolkata
 Phone : 91 9433037829 (M)
             91 33 - 25741829 (H)

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org