Perhaps there is a method...if not, try [a for a in Add.make_args(p.expand()) if sum(m.as_base_exp()[1] for m in Mul.make_args(a)) == n]
e.g. if p = (1+x+x*y)*(x+y) and n = 2 then the result is [x*y, x**2] On 6/21/12, manoj babu <[email protected]> wrote: > I think you should anyway run a for loop... > using subs func in for loop where loop runs for each arg. > What we all need here is an index. > I think there is some function terms in polyclasses close to this. > > On Thu, Jun 21, 2012 at 8:07 PM, [email protected] < > [email protected]> wrote: > >> > expr1 = expr.subs(x,y) >> This won't work because it will transform x**2+y**2 into 2*y**2 >> >> There must be something already implemented in the poly module, >> however I do not know enough about it to tell. >> >> -- >> 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. > > -- 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.
