Open Vaibhavdixit02 opened 4 months ago
That's a good point, thanks for raising the issue. I guess the short answer is that these two domains were developed at different times in different contexts. But they should interoperate better.
The technical reason that one works with HalfLine does and the other one doesn't, is that RealLine is implemented as a subtype of an interval and RealNumbers isn't. One improvement may be to implement canonicaldomain
for RealNumbers
and have it return a RealLine
. In that case various fallbacks will start to work and produce better answers.
Yet that wouldn't work for the other sets, i.e., one might also want that the rational numbers are a subset of the real line. Functionality like isequaldomain
falls back to issubset
, so if the various issubset
dependencies are added things should improve. That's probably the way to go: to implement issubset
for combinations of the number sets with an interval.
Separately, one can wonder whether the package needs both RealLine
and RealNumbers
. There are some subtle differences, though. The RealNumbers
type really just wraps the isreal
function, whereas RealLine
is an interval.
I'll put this on a todo list. Feel free to have a go at it if you like @Vaibhavdixit02. I'm thinking of implementations like the one here: https://github.com/JuliaApproximation/DomainSets.jl/blob/4e36278622df67839cea860a5d0f958c849db988/src/domains/interval.jl#L422
Functions to look at include intersectdomain
, setdiffdomain
, uniondomain
and issubset_domain
.
Coming back to the original question/confusion:
RealLine
when you want to work with intervals and/or interact with other domainsRealNumbers
when you are looking for a representation for the set of real numbers.For now, RealLine
is better supported.
I am a little confused about what the difference between the two is meant to be? What tripped me was this subset checking of
HalfLine
forRealNumbers
orRealLine