Ask Your Question
1

A question about definition of a polynomial ring.

asked 2022-01-23 10:29:07 +0200

lijr07 gravatar image

I am trying to define a polynomial ring as follows:

from sage.combinat import *
n=9
m=100
R = PolynomialRing(QQ,n*m,['x'+str(i)+str(j) for i in range(1,n+1) for j in range(1,m+1)])

It is ok with n=9, m=100. But when I change n, m to n=11, m=100. Then there is an error: ValueError: variable name 'x111' appears more than once

I would like to have n=100, m=1000. How to solve this problem? Thank you very much.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-01-23 12:02:31 +0200

rburing gravatar image

Sage is giving you a hint that your naming scheme is ambiguous. In particular, 'x111' appears more than once, because it is both 'x'+'1'+'11' and 'x'+'11'+'1'. You can add a separator like an underscore to avoid this:

['x{}_{}'.format(i+1,j+1) for i in range(n) for j in range(m)]
edit flag offensive delete link more

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: 2022-01-23 10:29:07 +0200

Seen: 231 times

Last updated: Jan 23 '22