Hi, The following problem was reported to the Sage bug tracker by Paul Zimmermann: http://trac.sagemath.org/sage_trac/ticket/9505 ginsh - GiNaC Interactive Shell (ginac V1.5.7) <snip> Type ?? for a list of help topics.
f = x*y*z^2; y*z^2*x coeff(f, z^2,1); y*x coeff(f, x*y,1); 0
I'd greatly appreciate any help fixing this. Cheers, Burcin
Hello, On Sun, Sep 19, 2010 at 5:14 PM, Burcin Erocal <burcin@erocal.org> wrote:
f = x*y*z^2; y*z^2*x coeff(f, z^2,1); y*x coeff(f, x*y,1); 0
Works as designed.
I'd greatly appreciate any help fixing this.
I think it's the user code which should be fixed. I.e. write f.coeff(x, 1).coeff(y, 1) instead of ill-defined f.coeff(x*y, 1) Best regards, Alexei
Hi Alexei, Thank you for the quick response. On Sun, 19 Sep 2010 18:37:56 +0200 Alexei Sheplyakov <alexei.sheplyakov@gmail.com> wrote:
On Sun, Sep 19, 2010 at 5:14 PM, Burcin Erocal <burcin@erocal.org> wrote:
f = x*y*z^2; y*z^2*x coeff(f, z^2,1); y*x coeff(f, x*y,1); 0
Works as designed.
Where can I find the specification for coeff()? I'd like to take a look at that before making any changes to the Sage function. Cheers, Burcin
Hi again,
Where can I find the specification for coeff()?
See the paragraph "Degree and coefficients" in the section "Polynomial arithmetic". Basically, coeff extracts a coefficient with a certain power from an expanded polynomial (that is, in e.coeff(x, n) e should be expanded w.r.t. x). Thus the first argument should be a symbol. Simetimes one can get sensible result even if the argument is not a symbol (see the examples in the manual). But in this case the only guarantee is that e.coeff(e, 1) is 1. Hope this helps, Alexei
participants (2)
-
Alexei Sheplyakov
-
Burcin Erocal