Skip to content

Commit

Permalink
imageset of first interval of singularities included
Browse files Browse the repository at this point in the history
fixes sympy/sympy#10113

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
  • Loading branch information
Gaurav Dhingra authored and skirpichev committed Jul 16, 2016
1 parent 840f68e commit 12db386
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sympy/sets/sets.py
Expand Up @@ -978,8 +978,8 @@ def _eval_imageset(self, f):
else:
return imageset(f, Interval(self.start, sing[0],
self.left_open, True)) + \
Union(*[imageset(f, Interval(sing[i], sing[i + 1]), True, True)
for i in range(1, len(sing) - 1)]) + \
Union(*[imageset(f, Interval(sing[i], sing[i + 1], True, True))
for i in range(0, len(sing) - 1)]) + \
imageset(f, Interval(sing[-1], self.end, True, self.right_open))

@property
Expand Down
10 changes: 10 additions & 0 deletions sympy/sets/tests/test_sets.py
Expand Up @@ -862,3 +862,13 @@ def test_issue_9637():
Interval(2, 3, left_open=True)), a, evaluate=False))
assert Complement(a, S.Reals) == Complement(a, S.Reals, evaluate=False)
assert Complement(a, Interval(1, 3)) == Complement(a, Interval(1, 3), evaluate=False)


def test_issue_10113():
f = x**2/(x**2 - 4)
assert imageset(x, f, S.Reals) == Union(Interval(-oo, 0, True),
Interval(1, oo, True, True))
assert imageset(x, f, Interval(-2, 2)) == Interval(-oo, 0, True)
assert imageset(x, f, Interval(-2, 3)) == Union(Interval(-oo, 0, True),
Interval(Rational(9, 5),
oo, False, True))

0 comments on commit 12db386

Please sign in to comment.