Ask Your Question
1

Call polynomial ring variables by index

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

vet99 gravatar image

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

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
2

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

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]                                                                                
x2
edit flag offensive delete link more

Comments

Thank you! Problem solved.

vet99 gravatar imagevet99 ( 2021-04-25 15:35:14 +0100 )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

Stats

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

Seen: 234 times

Last updated: Apr 25 '21