Yes, use expand=False: Poly((x + y)*z, t, domain='EX', expand=False)
Note that the generators must already be expanded out for this to work. This is also recommended anyway if you already know ahead of time that the generators are expanded out, because it will be much faster. But also keep in mind that Poly won't notice if you have x*z + y*z in another place that it is the same as (x + y)*z. Aaron Meurer On Thu, Sep 27, 2012 at 7:11 PM, Geoffrey Irving <[email protected]> wrote: > If I try to compute in a polynomial ring with arbitrary expression > coefficients, I get undesirable expansion: > >>>> from sympy import * >>>> x,y,z,t = symbols('x y z t') >>>> Poly((x+y)*z,t,domain=EX) > Poly(x*z + y*z, t, domain='EX') > > I would like to preserve the (x+y)*z structure of the coefficient for > later code generation purposes. Is there a way to do this? > > Thanks, > Geoffrey > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > 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/sympy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sympy" group. 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/sympy?hl=en.
