Readonly
intervalsConvenience generator to iterate over the internal intervals
const set = new NumberSet([Interval.Open(-1, 0), Interval.Open(0, 1)]);
for (const interval of set) {
console.log(interval.toString());
}
// "(-1,0)"
// "(0,1)"
The NumberSet's diameter (supremum of distances between two points in the set, e.g. largest upper bound minus the smallest lower bound in our case)
True if both sets represent the same abstract set
True if the sets aren't disjoint, e.g. their intersection is not empty
The NumberSet's radius (in our case diameter/2)
Transforms the set to its string representation by joining the intervals' string representation with ", " and surrounding the result with braces
console.log(
new NumberSet([Interval.Open(-1, 0), Interval.Open(0, 1)]).toString()
);
// "{(-1,0), (0,1)}"
This set's string representation
Static
fromConstructs a new NumberSet from the given intervals.
Note that the intervals are stored internally in a "normalized" manner meaning
Intervals representing this set
Static
fromAlpha
Constructs a NumberSet from a string representation
Expects a list of Interval string representations separated by ", " surrounded by curly braces. See fromString for more information on formatting intervals.
Prefer constructing directly from Intervals instead of strings if possible
NumberSet.fromString("{(-1,0), (0,1)}").equals(new NumberSet([
Interval.Open(-1,0), Interval.Open(0,1)
])); // true
NumberSet corresponding to the string representation
ParseError if s is malformed
String representation of the NumberSet
Generated using TypeDoc
A set of numbers represented by the union of disjoint intervals
Remarks