Skip to content

Commit

Permalink
Merge pull request #19431 from mloubout/collectho
Browse files Browse the repository at this point in the history
Unevaluated collect with symbols in factors
  • Loading branch information
smichr committed May 26, 2020
2 parents 61469da + 621ffb3 commit 0ef0444
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sympy/simplify/radsimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def collect(expr, syms, func=None, evaluate=None, exact=False, distribute_order_
if not isinstance(rv, dict):
return rv.xreplace(urep)
else:
return {urep.get(k, k): v for k, v in rv.items()}
return {urep.get(k, k): v.xreplace(urep) for k, v in rv.items()}

if evaluate is None:
evaluate = global_parameters.evaluate
Expand Down
6 changes: 6 additions & 0 deletions sympy/simplify/tests/test_radsimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ def test_collect_5():
[x, y]) == 1 + y + x*(1 + 2*y) + x**2 + y**2


def test_collect_pr19431():
"""Unevaluated collect with respect to a product"""
a = symbols('a')
assert collect(a**2*(a**2 + 1), a**2, evaluate=False)[a**2] == (a**2 + 1)


def test_collect_D():
D = Derivative
f = Function('f')
Expand Down

0 comments on commit 0ef0444

Please sign in to comment.