On 9/14/07, David Stahl <[EMAIL PROTECTED]> wrote:
> Thank you William. Unfortunately the coefficient command does not
> appear to allow me to determine what terms the coefficients are
> associated with. If I had the expression:
>
> a*x^2+b*x*y +c*y^2
>
> and the b term was zero the output would be [a,c] but I would not
> know if the zero element was a, b, or c. That's why I was trying to
> get coeff() to work because it allows me to check for each term
> individually. Is there a way to coerce the groebner_basis() output
> into the correct form to allow coeff() to work?
You can turn a multivariate polynomial f into a symbolic expression,
i.e., an elmenet of the Symbolic Ring SR by typing
sage: SR(f)
Continue the above example, we have:
sage: h = [SR(z) for z in g]
sage: h[0].coeff('x')
0
sage: h[0].coeff('a')
0
sage: h[0].coeff('c')
1
sage: h[1].coeff('c')
3
sage: h[2].coeff('c')
2
sage: h[2].coeff('b')
2
This isn't necessary fast, but might be fine for your application, and
at least you know exactly how coeff works.
-- William
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---