Ask Your Question

Call polynomial ring variables by index

asked 2021-04-24 20:12:45 +0200

vet99 gravatar image

updated 2021-04-25 14:47:31 +0200

slelievre gravatar image

In my study I have to work with something like BooleanPolynomialRing(... 'x', 10).

After that I can create function in the form x1 + x1*x3 + ....

However I would like to create functions in more generic form like x[1] + x[2]*x[3] where x[1] is equivalent for x1, etc.

The final goal is to be able to construct functions programmatically combining indexed expressions like x[i] + x[j] etc.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-04-25 02:16:38 +0200

Is this what you want?

sage: R = BooleanPolynomialRing(10, 'x')                                                  
sage: R                                                                                   
Boolean PolynomialRing in x0, x1, x2, x3, x4, x5, x6, x7, x8, x9
sage: x = R.gens()                                                                        
sage: x                                                                                   
(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)
sage: x[2]                                                                                
edit flag offensive delete link more


Thank you! Problem solved.

vet99 gravatar imagevet99 ( 2021-04-25 15:35:14 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-04-24 20:11:27 +0200

Seen: 38 times

Last updated: Apr 25