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, ri
r1 = xbin[1] - (xbin[2] - xbin[1])/2
ri = xbin[i] - (xbin[i] - xbin[i-1])/2
for
i = 2, 3, ..., n
rn+1 = xbin[n] + (xbin[n] - xbin[n-1])/2
For each i = 1, 2, ..., LEN(x)
find j
so that
rj ≤ x[i] < rj+1
for some
j = 1, 2, ..., n
. If j = n
, then
xcount[n]
is incremented by 1
, otherwise, let
w = (x[i]-xbin[j])/(rj+1+rj)/2
then
xcount[j]
is incremented by 1 - w
and xcount[j+1]
is incremented by
w
.