> So that's the price to pay.  In my branch, hints are applied exactly
> once, in whatever order they are applied in (I'm not planning on
> messing with that for now).  In master, they are recursively applied
> several times.  The result is that in my branch, things should be
> faster, but you may have to call expand() multiple times to get a
> fully expanded expression if it happens to require multiple passes to
> do so.

Initially, I don't like this (and that was the intent of modifying
Add._eval_expand_mul, I would guess). If I use the hint expand_mul, I
would like to know that there is no Mul containing an Add factor left
when the expansion is done. On the other hand, if we had well defined,
one level of expansion methods to handle a single hint (as I imagine
you are proposing)  then those could be used with more discretion and
confidence of not being excessively recursive -- the recursion would
be handled by the method that uses the focused expander. For example,
say expand_mul only did a single level of expansion on a Mul. This,
then might be how it would be used in expand when given a mul=True
hint:

def expand(mul=False):
  if mul:
    e = expr
    while 1:
      expr = e.xreplace(Transform(lambda w:expand_mul(w), lambda
w:w.is_Mul and any(f.is_Add for f in w.args)))
      if expr == e:
        break
  return expr

-- 
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.

Reply via email to