You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,12 +15,16 @@ intervals upon which other packages might build. In particular, we
15
15
for the reason that only one interval package can
16
16
unambiguously define the `..` and `±` operators (see below).
17
17
18
-
Currently this package defines one concrete type, `ClosedInterval`.
19
-
These define the closed set spanning from `a` to `b`, meaning the
18
+
Currently this package defines one concrete type, `Interval`.
19
+
These define the set spanning from `a` to `b`, meaning the
20
20
interval is defined as the set `{x}` satisfying `a ≤ x ≤ b`. This is
21
21
sometimes written `[a,b]` (mathematics syntax, not Julia syntax) or
22
22
`a..b`.
23
23
24
+
Optionally, `Interval{L,R}` can represent open and half-open intervals. The type
25
+
parameters `L` and `R` correspond to the left and right endpoint respectively.
26
+
The notation `ClosedInterval` is short for `Interval{:closed,:closed}`, while `OpenInterval` is short for `Interval{:open,:open}`. For example, the interval `Interval{:open,:closed}` corresponds to the set `{x}` satisfying `a < x ≤ b`.
27
+
24
28
## Usage
25
29
26
30
You can construct `ClosedInterval`s in a variety of ways:
@@ -73,6 +77,15 @@ true
73
77
74
78
julia> (0.25..5) ∪ (3..7.4) # \cup<TAB>; can also use union()
75
79
0.25..7.4
80
+
81
+
julia>isclosedset(0.5..2.0)
82
+
true
83
+
84
+
julia>isopenset(OpenInterval(0.5..2.5))
85
+
true
86
+
87
+
julia>isleftopen(2..3)
88
+
false
76
89
```
77
90
78
91
When computing the union, the result must also be an interval:
0 commit comments