Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Pass a list of variable names as parameter to a polynomial ring

I am trying to write a function that compute a vector space basis $B$ for the quotient ring $k[x_1,\dots,x_n]/I$. I want to make the list of variables as the input parameter.

I tried this:

var("x,y")
Vlist=[x,y] 
P.<Vlist>=PolynomialRing(QQ,order='degrevlex')
f=x^2+y^3
f.lm()

It gave me error message. I also tried

Vlist=['x,y']

or

Vlist=["x,y"]

None of them works. I know that

P.<x,y>=PolynomialRing(QQ,order='degrevlex')
f=x^2+y^3
f.lm()

works. So I can just type this before I run my function. But is there a way that I can make this as input of the function?

Pass a list of variable names as parameter to a polynomial ring

I am trying to write a function that compute a vector space basis $B$ for the quotient ring $k[x_1,\dots,x_n]/I$. I want to make the list of variables as the input parameter.

I tried this:

var("x,y")
Vlist=[x,y] 
P.<Vlist>=PolynomialRing(QQ,order='degrevlex')
f=x^2+y^3
f.lm()

It gave me error message. I also tried

Vlist=['x,y']

or

Vlist=["x,y"]

None of them works. I know that

P.<x,y>=PolynomialRing(QQ,order='degrevlex')
f=x^2+y^3
f.lm()

works. So I can just type this before I run my function. But is there a way that I can make this as input of the function?