Skip to content

Commit

Permalink
simplify: workaround for expanded exponents in hypersimp()
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Jun 2, 2021
1 parent b15e82f commit 9d193cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions diofant/simplify/simplify.py
Expand Up @@ -372,6 +372,7 @@ def hypersimp(f, k):
g = g.rewrite(gamma)
g = expand_func(g)
g = powsimp(g, deep=True, combine='exp')
g = g.cancel()
g = combsimp(g)

if g.is_rational_function(k):
Expand Down
2 changes: 2 additions & 0 deletions diofant/tests/simplify/test_simplify.py
Expand Up @@ -292,6 +292,8 @@ def test_hypersimp():
term = binomial(n, k)*(-1)**k/factorial(k)
assert hypersimp(term, k) == (k - n)/(k + 1)**2

assert hypersimp(2**(I*k) * 2**k, k) == 2**(1 + I)


def test_nsimplify():
assert nsimplify(0) == 0
Expand Down

0 comments on commit 9d193cb

Please sign in to comment.