Good example.  It would make a good test (if you haven't done this already).


On Sat, Jan 4, 2014 at 8:11 AM, Harsh Gupta <notifications@github.com>wrote:

> In sympy/core/sets.py:
>
> >          # TODO: manage left_open and right_open better in case of
> > -        # non-comparable left/right (e.g. Interval(x, y))
> > -        _left, _right = f(self.left), f(self.right)
> > -        left, right = Min(_left, _right), Max(_left, _right)
> > -        if _right == left: # switch happened
> > -            left_open, right_open = self.right_open, self.left_open
> > +        # non-comparable left/right (e.g. Interval(x, y)
> > +        # TODO: handle piecewise defined functions
> > +
> > +        _start, _end = f(self.start), f(self.end)
> > +        if self.left_open:
> > +            _start = limit(f.expr, f.variables[0], self.start, dir="+")
>
> It is necessary to use limits to evaluate the value of the function at the
> edge of the interval if it is not a closed interval from that side. Because
> the limiting value of the function at point might be different from the
> value of the function at that point. For example evaluating without limits
> gives wrong result in this case:
>
> In [4]: imageset(x, 1/x, Interval(-1, 0, True, True))
> Out[4]: (-1, oo)
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/sympy/sympy/pull/2723/files#r8651949>
> .
>