A histogram is defined by the following struct,
size_t n
double * range
double * bin
The range for bin[i] is given by range[i] to range[i+1]. For @math{n} bins there are @math{n+1} entries in the array range. Each bin is inclusive at the lower end and exclusive at the upper end. Mathematically this means that the bins are defined by the following inequality,
Here is a diagram of the correspondence between ranges and bins on the number-line for @math{x},
[ bin[0] )[ bin[1] )[ bin[2] )[ bin[3] )[ bin[5] ) ---|---------|---------|---------|---------|---------|--- x r[0] r[1] r[2] r[3] r[4] r[5]
In this picture the values of the range array are denoted by
@math{r}. On the left-hand side of each bin the square bracket
"[
" denotes an inclusive lower bound
(@c{$r \le x$}
@math{r <= x}), and the round parentheses ")
" on the right-hand
side denote an exclusive upper bound (@math{x < r}). Thus any samples
which fall on the upper end of the histogram are excluded. If you want
to include this value for the last bin you will need to add an extra bin
to your histogram.
The gsl_histogram
struct and its associated functions are defined
in the header file `gsl_histogram.h'.