[sage-support] Re: creating variables in Polynomial Ring

2010-09-07 Thread John H Palmieri
On Sep 7, 10:47 am, tvn nguyenthanh...@gmail.com wrote: Hi, given a list of variable names as strings (e.g.,  l = ['a','b','c','d'])  I try to make those become variables in a Polynomial Ring.  One way is to do something like R.a,b,c,d=CC['a','b','c','d'] ,  after this the type of a or b or c

[sage-support] Re: creating variables in Polynomial Ring

2010-09-07 Thread Jason Grout
On 9/7/10 12:47 PM, tvn wrote: Hi, given a list of variable names as strings (e.g., l = ['a','b','c','d']) I try to make those become variables in a Polynomial Ring. One way is to do something like R.a,b,c,d=CC['a','b','c','d'] , after this the type of a or b or c or d isclass

[sage-support] Re: creating variables in Polynomial Ring

2010-09-07 Thread tvn
Hi John and Jason, thanks -- the inject_variables() did what I want. I have another question below and hope you can help what if I already have create a function call f = x - y as below sage: vs = var('x y') sage: f = x - y sage: type(f) type 'sage.symbolic.expression.Expression' now I

[sage-support] Re: creating variables in Polynomial Ring

2010-09-07 Thread Jason Grout
On 9/7/10 3:34 PM, tvn wrote: Hi John and Jason, thanks -- the inject_variables() did what I want. I have another question below and hope you can help what if I already have create a function call f = x - y as below sage: vs = var('x y') sage: f = x - y sage: type(f) type

[sage-support] Re: creating variables in Polynomial Ring

2010-09-07 Thread tvn
ah thanks much -- I also just found it by just trial and error. On Sep 7, 2:39 pm, Jason Grout jason-s...@creativetrax.com wrote: On 9/7/10 3:34 PM, tvn wrote: Hi John and Jason,  thanks  --  the inject_variables() did what I want. I have another question below and hope you can

[sage-support] Re: creating variables in Polynomial Ring

2010-09-07 Thread tvn
There's still one type error about parent mismatch in my code. Basically I want to write a function foo like below def foo(f1,f2,vs): R = PolynomialRing(QQ,vs) f1_ = f1.polynomial(QQ) f2_ = f2.polynomial(QQ) I = R*[f1_] G = I.radical().groebner_basis() res =

[sage-support] Re: creating variables in Polynomial Ring

2010-09-07 Thread Nils Bruin
On Sep 7, 1:34 pm, tvn nguyenthanh...@gmail.com wrote: Hi John and Jason,  thanks  --  the inject_variables() did what I want. I have another question below and hope you can help what if I already have create a function call f = x - y as below sage: vs = var('x y') sage: f = x - y sage:

[sage-support] Re: creating variables in Polynomial Ring

2010-09-07 Thread tvn
Nils, thanks -- I think I was able to do what I want using your code snippet def foo(f1,f2,vs): R = PolynomialRing(QQ,vs) f1_ = R(f1) f2_ = R(f2) I = R*[f1_] G = I.radical().groebner_basis() res = f2_.reduce(G) return res == 0 On Sep 7, 3:04 pm, Nils Bruin

[sage-support] Re: creating variables in Polynomial Ring

2010-09-07 Thread Jason Grout
On 9/7/10 4:04 PM, Nils Bruin wrote: On Sep 7, 1:34 pm, tvnnguyenthanh...@gmail.com wrote: Hi John and Jason, thanks -- the inject_variables() did what I want. I have another question below and hope you can help what if I already have create a function call f = x - y as below sage: vs =