... In many parts of mathematics ( recall \( \sum^{max}_{x=1} f(x) \) ).
Closed interval denoted as [begin, end] (inclusive).
Closed interval in Wolfram Mathematica:
In[4]:= Sum[x,{x,1,10}]
Out[4]= 55
...
In[2]:= Table[x,{x,1,10}]
Out[2]= {1,2,3,4,5,6,7,8,9,10}
(BTW, vectors often started at index 1, like in Wolfram Mathematica and also FORTRAN.)
The notation ":" denotes a subarray. Thus, A[i : j] indicates the subarray of A consisting of the elements A[i], A[i + 1], ..., A[j]. We also use this notation to indicate the bounds of an array, as we did earlier when discussing the array A[1 : n]. ... 7 If you’re used to programming in Python, bear in mind that in this book, the subarray A[i : j] includes the element A[j]. In Python, the last element of A[i : j] is A[j - 1]. Python allows negative indices, which count from the back end of the list. This book does not use negative array indices.( Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein -- Introduction to Algorithms, Fourth Edition )
GNU coreutils, README file:
For any copyright year range specified as YYYY-ZZZZ in this package note that the range specifies every single year in that closed interval.
UNIX shell and regexps: [a-z] is closed interval.
If your rating in Uber is 4.8, it's in fact lies in [4.75, 4.85], due to rounding:
% python3 >>> "%1.1f" % 4.75 '4.8' >>> "%1.1f" % 4.85 '4.8' >>> "%1.1f" % 4.849999999999 '4.8' >>> "%1.1f" % 4.850000000001 '4.9'
Also closed interval:
random.randint(a, b) Return a random integer N such that a <= N <= b. Alias for randrange(a, b+1).
( https://docs.python.org/3/library/random.html )
From suckless st. BETWEEN: this is closed interval.
#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))
...
#define ISCONTROLC0(c) (BETWEEN(c, 0, 0x1f) || (c) == 0x7f)
#define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
...
int
selected(int x, int y)
{
if (sel.mode == SEL_EMPTY || sel.ob.x == -1 ||
sel.alt != IS_SET(MODE_ALTSCREEN))
return 0;
if (sel.type == SEL_RECTANGULAR)
return BETWEEN(y, sel.nb.y, sel.ne.y)
&& BETWEEN(x, sel.nb.x, sel.ne.x);
return BETWEEN(y, sel.nb.y, sel.ne.y)
&& (y != sel.nb.y || x >= sel.nb.x)
&& (y != sel.ne.y || x <= sel.ne.x);
}
Colloquial speech: "buy 10-15 eggs", "I drink 2-4 shots at evening"
