-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
infinite intervals #9
Comments
Infinite endpoints are legitimate for intervals: https://en.wikipedia.org/wiki/Interval_(mathematics) So I don't agree that the current behaviour is a bug. In ApproxFun I have domains for function Base.convert(::Type{Domain},d::ClosedInterval)
a,b=d.left,d.right
if abs(a) == Inf && abs(b) == Inf
Line(d)
elseif abs(a) == Inf || abs(b) == Inf
Ray(d)
else
Segment(d)
end
end This pattern may be useful for your case: have convert routines from the current |
@dlfivefifty : Infinite endpoints are indeed OK, but the resulting interval is not closed. So I don't know the internals of
so that one can dispatch on them. For example, if I am approximating something with Chebyshev polynomials, I would adjust the nodes to include endpoints depending on whether the interval is closed. Whether this should be part of this package is a good question, but from the general types I see in the source my understanding is that this was planned for finite intervals at least. The alternative is
|
It's closed on the compactified real line: ℝ ∪ {∞} .
This is off topic, but in my experience, you're better off always using the first kind Chebyshev points, which ApproxFun has changed to as the default. This avoids endpoint singularities. First kind points may be useful for collocation, but collocation is O(n^3) and unstable....
What should be in this package is I don't actually like that naming scheme, so maybe something like: typealias ClosedInterval{T} Interval{true,true,T}
typealias OpenInterval{T} Interval{false,false,T} |
Sometimes the solution you describe fits the problems I work on, but sometimes it doesn't. Currently I am working on an MCMC problem, and the posterior sampler I am using can handle ℝⁿ→ℝ functions nicely, but my parameters are constrained, some on (0,∞), some on (0,1). It is customary to map these to ℝ using logistic and log transformations. Implementing this in Julia, it is nice to dispatch on (semi-)finiteness. However, no matter how nice a unified type hierarchy would be for this, perhaps the needs of individual domains need to crystallize before we attempt that. |
OK your usage is very close to mine, in that we are using intervals to represent domains, rather than, say interval arithmetic. Along with maps to project between domains. It might be worthwhile to have a unified package for this usage case, though this is relevant: https://github.com/zenna/AbstractDomains.jl |
PS [0,Inf) is a closed set on R as its complement(-Inf,0) is an open set |
@dlfivefifty indeed, but AFAIK for intervals "closed" means "contains the endpoint". This is a convention, and as you pointed out, it does not map well to topological considerations, especially on the extended real line. |
No, it means any limit sequence limits inside of the set. So for this reason R is actually clopen. But this is weird stuff we work with in pure math that really doesn't mean much to reality... I must say I like the typealias version. However, is there a way this extends to more general domains? |
The original question is already solved, so I'll close this issue. We may need some additional types to represent half infinite intervals such as |
Recently I came across a problem where it would have been nice to represent infinite intervals. Currently
works, but
[x,Inf)
,(-Inf,x]
, and(-Inf,Inf)
intervals should be represented by distinct types (I want to dispatch on them), and this type should be distinct from potential finite-width (half-)open interval types (cf Roadmap #1).Would the maintainers be open to a PR that adds eg a
ClosedPosInfInterval
,ClosedNegInfInterval
,RealLine
, for the above interval types? I would be happy to do one. Just help me name them better.The text was updated successfully, but these errors were encountered: