I need to manipulate some intervals of real numbers. I will mainly do unions and their crossroads. Thus, I always get sets of real numbers, which are the union of a finite number of intervals.
I am currently using sympy for python. My question is: if the Set simplex is given, is there a (good) way to iterate over its intervals?
One possibility is to use a set representation string that looks something like this:
(-oo, 5] U [7, 20]
and then use regular expressions to unpack it.
Is there a nicer and easier way python?
source share