Hi Davide, Interval is a type of Set whereas both AccumulationBounds and SetExpr are types of Expr. The methods and operations of Set and Expr are very different and not interchangeable so if we want to be able to manipulate an AccumBounds like an expression then it can't be a subclass of Interval.
The difference between SetExpr and AccumBounds is that AccumBounds is only a bound so its arithmetic does not need to be exact e.g.: In [10]: 1 / SetExpr(Interval(-1, 1)) Out[10]: SetExpr((-∞, -1] ∪ [1, ∞)) In [11]: 1 / AccumBounds(-1, 1) Out[11]: <-∞, ∞> Here both results are correct. The AccumBounds is correct because it "bounds the result". The SetExpr result is correct because anything between -1 and 1 is not included in the set. Interval arithmetic can give either result depending on whether you work with intervals or unions of intervals (multi-intervals). The normal idea of interval arithmetic though is to use floating point with outer rounding. I have an implementation of multi-intervals based on mpmath's mpi type here: https://github.com/sympy/sympy/issues/19164 Oscar On Wed, 24 Jun 2020 at 12:38, Davide Sandona' <[email protected]> wrote: > > I'm exploring the source code and I have a conceptual problem: why > `AccumulationBounds` does not inherit from `Interval`? After all, it is an > interval with closed ends...I understand it is possible to do interval > arithmetic with `AccumulationBounds`, however I've also seen the class > `SetExpr` which should allow to do the same with set objects... > > Thank you for your time, > > Davide. > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/14b860f2-5e29-4dd0-9cd3-74b92fc6a2c6o%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxQnu7KkSaQ1xwy0BzpbkwqiJnau05M-n5B53OavmU-Xvg%40mail.gmail.com.
