[sage-devel] Re: multivariate polynomial coefficients

2007-10-13 Thread cwitty
On Oct 13, 6:51 am, "Joel B. Mohler" <[EMAIL PROTECTED]> wrote: > I'm wondering if we could have a vote on preferred syntax. I'm not going to > describe the parameters because if they are not clear enough from context, it > probably isn't a good parameter choice :) : > > sage: P.=ZZ[] > sage: f=(

[sage-devel] Re: multivariate polynomial coefficients

2007-10-13 Thread didier deshommes
2007/10/13, Joel B. Mohler <[EMAIL PROTECTED]>: > > Thanks for the discussion about this topic. I send this mail to re-iterate > and summarize. It seems there are two things that you might want: > 1) Get the coefficient of a specific monomial in the multivariate polynomial > ring. > 2) Get the

[sage-devel] Re: multivariate polynomial coefficients

2007-10-13 Thread Joel B. Mohler
Thanks for the discussion about this topic. I send this mail to re-iterate and summarize. It seems there are two things that you might want: 1) Get the coefficient of a specific monomial in the multivariate polynomial ring. 2) Get the coefficient of the polynomial in a tower of (two) polynom

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread Robert Bradshaw
I think that the hard part here is identifying what variables you consider to be in the coefficient basering and what ones are not. I would propose there be an optional parameter basering to the coefficient function. By default it would be the base ring of the polynomial, and coefficient w

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread Nils Bruin
On Oct 12, 1:25 pm, "Joel B. Mohler" <[EMAIL PROTECTED]> wrote: [...] > Suppose I had a poly ring with 19 variables and one of them was named "y". > How would I get the coefficient for y^0 in your syntax? (That is, the > constant term in k[y][...].) This is the sticking point in what is curren

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread Joel B. Mohler
On Friday 12 October 2007 15:52, Nils Bruin wrote: > Both the poly.coefficients({x:1,y:2}) and poly.coefficients(x=1,y=2) > seem confusing to me (the latter one downright scary. Exponents and > variable names have no business being on opposite sides of an equality > sign). Yes, I agree, mathemat

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread cwitty
On Oct 12, 12:27 pm, [EMAIL PROTECTED] wrote: > On Fri, 12 Oct 2007, Joel B. Mohler wrote: > > Hmm, possibly. kwargs feels scary to me with variables since the 'x' in the > > kwargs parameter list is a totally different 'x' than the one in P.gen(0). > > They just happened to be named the same in

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread Nils Bruin
Both the poly.coefficients({x:1,y:2}) and poly.coefficients(x=1,y=2) seem confusing to me (the latter one downright scary. Exponents and variable names have no business being on opposite sides of an equality sign). In mathematical terms, what you want to do is view the polynomial ring k[x,y,z] as

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread boothby
On Fri, 12 Oct 2007, Joel B. Mohler wrote: > > On Friday 12 October 2007 13:36, Mike Hansen wrote: >> If you're doing a dictionary anyway, doesn't it make more sense to use >> **kwargs? For example, >> >> sage: P.=ZZ[] >> sage: f=x*y^2+x*y+y+x+1 >> sage: f.coefficient(y=2) >> x >> sage: f.coe

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread Joel B. Mohler
On Friday 12 October 2007 13:36, Mike Hansen wrote: > If you're doing a dictionary anyway, doesn't it make more sense to use > **kwargs?  For example, > > sage: P.=ZZ[] > sage: f=x*y^2+x*y+y+x+1 > sage: f.coefficient(y=2) > x > sage: f.coefficient(y=1) > x + 1 > sage: f.coefficient(x=1, y=2) > 1 >

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread Mike Hansen
If you're doing a dictionary anyway, doesn't it make more sense to use **kwargs? For example, sage: P.=ZZ[] sage: f=x*y^2+x*y+y+x+1 sage: f.coefficient(y=2) x sage: f.coefficient(y=1) x + 1 sage: f.coefficient(x=1, y=2) 1 It takes a little bit to get used to the semantics of it, but the syntax

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread didier deshommes
2007/10/12, Joel B. Mohler <[EMAIL PROTECTED]>: > sage: P.=ZZ[] > sage: f=x*y^2*z^3+y^2*z > sage: f.coefficient(y,2,z,3) # I want the "coefficient" of y^2*z^3 > # Bang > > That doesn't seem very nice to me. Good point: Dictionary it is then. (Incidentally, there downs seem a non-obvious way to d

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread Soroosh Yazdani
Another *possible* way of sage behaving is sage: P.=ZZ[] sage: f=x*y^2+x*y+y+x+1 sage: f.coefficient(y^2) 0 sage: f.coefficient(y^1) 1 sage: f.coefficient(y^0) 1 Now, I'm not sure if this is better or not, but I thought maybe I should point it out. The biggest problem with this is that if you do

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread Joel B. Mohler
On Friday 12 October 2007 11:41, didier deshommes wrote: > But: > > coeff(f,y,0); > >                                               x + 1 > > returns the right answer > > Actually I like Maple's notation better here over the dictionary > notation you proposed: it is as intuitive and I have to type

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread didier deshommes
2007/10/12, Joel B. Mohler <[EMAIL PROTECTED]>: > > This e-mail is too long. Here's the bottom line: I suggest that the > coefficient method on a multivariate polynomial ring take a dictionary > indicating the variables and degrees that you want to restrict your attention > to. > > It seems that

[sage-devel] Re: multivariate polynomial coefficients

2007-10-12 Thread cwitty
On Oct 12, 7:36 am, "Joel B. Mohler" <[EMAIL PROTECTED]> wrote: > This e-mail is too long. Here's the bottom line: I suggest that the > coefficient method on a multivariate polynomial ring take a dictionary > indicating the variables and degrees that you want to restrict your attention > to. So