Hi Francesc,
On Wed, Aug 6, 2014 at 2:24 PM, Francesc Ferrer
<[email protected]> wrote:
> Hello,
>
> Repeated calls to 'coeff' give inconsistent results:
>
> import sympy
>
> x, y, a, b = sympy.symbols( 'x y a b')
>
> f = a*x**2*y**2 + b*x*y**2
>
> Then, the commands 'f.coeff(x,2).coeff(y,2)' and 'f.coeff(y,2).coeff(x,2)'
> both give 'a', which is correct.
>
> The command f.coeff(y,0).coeff(x,2) gives 0 as expected.
>
> However, f.coeff(x,2).coeff(y,0) gives 'a', which is wrong!
>
> Is this a bug, or am I missing something obvious?
Which sympy version are you using? I just tried a recent git version
(49bf47d24e3bcbe3e7d16e6bf08216ab1976f410) and I can't reproduce the
behavior
you described:
In [1]: var("x y a b")
Out[1]: (x, y, a, b)
In [2]: f = a*x**2*y**2 + b*x*y**2
In [3]: f
Out[3]:
2 2 2
a⋅x ⋅y + b⋅x⋅y
In [4]: f.coeff(x, 2)
Out[4]:
2
a⋅y
In [5]: f.coeff(x, 2).coeff(y, 2)
Out[5]: a
In [6]: f.coeff(x, 2).coeff(y, 0)
Out[6]: 0
Ondrej
>
> -Francesc
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/1462c15f-0e97-43ee-9685-091342b0b0bf%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/CADDwiVD7q2g7mx0%3DPQo6N%3DY80BsgvOxTTfh2_83eYh_MEBCoNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.