Hi,

On 29 January 2014 10:08, Roderick de Nijs <razor4...@gmail.com> wrote:
> I am having the following little anoying issue:
> Imagine i have:
>
> from sympy import var
> var('x y z t')
> p=Poly(x*y + x*z + z*t,gens=[x,y])
>
> now i can use p.coef_monomial to extract coefficients for x, y or x*y but
> how do I get the "constant" part z*t?
>
> Any straightforward way to do this?

In [1]: p=Poly(x*y + x*z + z*t,gens=[x,y])

In [2]: p.coeff_monomial(1)
Out[2]: t⋅z

or

In [3]: p.coeffs()[-1]
Out[3]: t⋅z

> Thanks!
>
> --
> 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 sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.

Mateusz

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to