BIN

WEIGHTS

 Syntax: BIN\WEIGHTS               w x xbin xcount
         BIN\WEIGHTS\AVERAGE       w x xbin xcount
         BIN\WEIGHTS\EMPTY         w x xbin xcount
         BIN\WEIGHTS\EDGES         w x xbin xcount
         BIN\WEIGHTS\EDGES\AVERAGE w x xbin xcount
         BIN\WEIGHTS\EDGES\EMPTY   w x xbin xcount

 By default, the i_th event causes the bin count to be incremented by 1.
 If a weight vector, w, is entered, you must indicate that it is there by
 using the \WEIGHTS qualifier. The i_th event causes the bin count to be
 incremented by w[i]. 

NBINS

 Syntax: BIN\NBINS x xbin xcount n { xmin xmax }
 Defaults: xmin = min(x), xmax = max(x)

 By default, the bins are defined by their centres, given in vector xbin,
 which must be strictly monotonically increasing. If the \NBINS qualifier
 is used, the number of bins, n, is expected. A new vector, xbin, will be
 created which will contain n elements. If the numbers xmin and xmax are
 not entered, they default to the minimum and maximum of vector x. The xbin
 vector will be:   xbin[i] = xmin+(i-0.5)*(xmax-xmin)/n  for  i=1,2,...,n

LAGRANGE

 Syntax: BIN\LAGRANGE x xbin xcount

 If the \LAGRANGE qualifier is used, \WEIGHTS, \EDGES, \AVERAGES, and
 \EMPTY are not allowed. If n=len(xbin), define the bin ranges, r[i]
  r[1]   = xbin[1]-(xbin[2]-xbin[1])/2
  r[i]   = xbin[i]-(xbin[i]-xbin[i-1])/2  for  i=2,3,...,n
  r[n+1] = xbin[n]+(xbin[n]-xbin[n-1])/2
 For each i=1,2,...,len(x)  find j so that r[j] <= x[i] < r[j+1] for
 some j=1,2,...,n.  If j = n, then xcount[n] is incremented by 1,
 otherwise, let w = (x[i]-xbin[j])/(r[j+1]+r[j])/2 then xcount[j] is
 incremented by 1-w and xcount[j+1] is incremented by w. 

AVERAGE

 Syntax: BIN\AVERAGE       x xbin xcount
         BIN\AVERAGE\EDGES x xbin xcount

 The \AVERAGE qualifier means that the output xcount vector will contain
 the average value for each bin.  An internal counter is kept for each
 bin, and the value for xcount[i] will be divided by the number of events
 in bin i before it is output.  Thus, BIN\EMPTY results in the same output
 as BIN\AVERAGE.  \AVERAGE can be used with \WEIGHT and \EDGES, but not
 with \EMPTY.

EMPTY

 Syntax: BIN\EMPTY       x xbin xcount
         BIN\EMPTY\EDGES x xbin xcount

 The \EMPTY qualifier means that an event is counted in a bin only if
 that bin is empty.  So only the first event encountered for each bin
 will be counted in that bin. \EMPTY can be used with \WEIGHT and \EDGES,
 but not with \AVERAGE.

EDGES

 Syntax: BIN\EDGES x xbin xcount

 By default, bins are defined by their centres. If the \EDGES qualifier
 is used, bins are defined by their edges. The bin edges must be given
 in vector xbin. The length of xcount will be one less than the length of
 xbin. A weight vector, w, may be specified if you use the \WEIGHTS
 qualifier.  If  xbin[j] <= x[i] < xbin[j+1]  then xcount[j] is incremented
 by 1, or by the weight, w[i].