ok = lambda w: (z in w.free_symbols and
any(a.is_polynomial(z) or
any(z in m.free_symbols and m.is_polynomial(z)
for m in Mul.make_args(a))
for a in Add.make_args(w)))
This is the ok function which checks whether it should apply the heuristics
here or not.
I think "any" should be replaced by "all" i.e. all the terms in the
expression should be polynomials.
Although there might be cases where expressions which are not polynomials
work using
this heuristic, it's better to be stricter. At-least it won't give wrong
answers!
If this is fine, I'll send the PR fixing this?
--
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.
For more options, visit https://groups.google.com/groups/opt_out.