Comment #3 on issue 1646 by asmeurer: Solving inequalities
http://code.google.com/p/sympy/issues/detail?id=1646
Well, it looks better that what already exists. There are some things
though. For starters, I found this bug:
In [13]: a = Interval(3, 4)
In [14]: b = Interval(1, 2)
In [15]: a.intersect(b)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Users/aaronmeurer/Documents/Python/sympy/sympy/<ipython console> in
<module>()
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/interval.py in
intersect(self, other)
61 if empty:
62 raise ValueError, "Intersection of intervals %s and %s
is empty" % \
---> 63 str(self), str(other)
64
65 return self.__class__(start, end, left_open, right_open)
TypeError: not enough arguments for format string
You messed up your string formatting, but aside from that, I think we
should have an EmptySet class that would
be returned here instead of raising ValueError. IMHO, you should only
raise ValueError if you screwed up the
arguments some how, as in giving the wrong types. For example, something
like solve(Eq(x, x + 1), x) just
returns [], not raises ValueError.
As far as Unions and open-closed formats, I guess it is debatable. I had
originally liked the '[]', '(]' idea from the
list, but I am thinking now that maybe your dual keyword argument method is
simpler.
As for unions, the disadvantage of having a list, aside from the fact that
you can't represent infinite unions, it
that you can have no data attributes or methods on it. Wouldn't it be
better to have a union class that is a subset
of some kind of Set class that has a method that returns a list.
Also, one more thing:
In [24]: a = Interval(1, 2)
In [25]: b = Interval(2, 3)
In [26]: a.intersect(b)
Out[26]: 2
Shouldn't this return the singleton {2}, as in either [2, 2] or set([2])?
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---