Skip to content

Commit

Permalink
Add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Apr 13, 2024
1 parent d9a9152 commit b351f58
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions diofant/tests/polys/test_polytools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3389,3 +3389,17 @@ def test_sympyissue_25723():
assert gcd(x - i, (x - i)*(2*x + 1)) == x - i

assert gcd(x - i, (x - i)*(2*x - 1)) == x - i


def test_sympyissue_26497():
a_n, m = symbols('a_n m', real=True, positive=True)
expr = (-a_n**4*m**2/(a_n**2 + 1) - 2*a_n**4*m/(a_n**2 + 1) -
a_n**4 - a_n**4/(a_n**2 + 1) + 2*I*a_n**3*m**2/(a_n**2 + 1) +
4*I*a_n**3*m/(a_n**2 + 1) + 2*I*a_n**3 +
2*I*a_n**3/(a_n**2 + 1) + 2*I*a_n*m**2/(a_n**2 + 1) +
4*I*a_n*m/(a_n**2 + 1) + 2*I*a_n + 2*I*a_n/(a_n**2 + 1) +
m**2/(a_n**2 + 1) + 2*m/(a_n**2 + 1) + 1 + 1/(a_n**2 + 1))
expr2 = (-a_n**2 + 2*I*a_n + 1)*(a_n**2 + m**2 + 2*m + 2)

assert expr.factor() == expr2
assert expr.subs({a_n: 1, m: 1}) == expr2.subs({a_n: 1, m: 1}) == 12*I
1 change: 1 addition & 0 deletions docs/release/notes-0.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ These Sympy issues also were addressed:
* :sympyissue:`26343`: TypeError: Invalid NaN Comparison using dsolve for ODE with ics={v(0) : 0}
* :sympyissue:`26313`: Error result for limit of a piecewise
* :sympyissue:`26477`: Error in integral result using hyper
* :sympyissue:`26497`: factor produces wrong output

0 comments on commit b351f58

Please sign in to comment.