Played with f/. and tolerance some more. Surprising! /. always does tolerant
comparisons when grouping. Including when 9!:18 is zero. And when tolerance
is applied to /. it will apply the tolerance to a named verb.
z
1 3 2 2 3 1 1 2 2 3
z-<.z
2.90878e_14 2.88658e_14 2.88658e_14 2.88658e_14 2.88658e_14 2.90878e_14
2.90878e_14 2.88658e_14 2.88658e_14 2.88658e_14
f=.[:<[=[:<.]
f
+--+-+---------------+
|[:|<|+-+-+---------+|
| | ||[|=|+--+--+-+||
| | || | ||[:|<.|]|||
| | || | |+--+--+-+||
| | |+-+-+---------+|
+--+-+---------------+
f/.~z
+-----+-----+-------+
|1 1 1|1 1 1|1 1 1 1|
+-----+-----+-------+
f/.!.0~z
+-----+-----+-------+
|0 0 0|0 0 0|0 0 0 0|
+-----+-----+-------+
f z
+-------------------+
|1 1 1 1 1 1 1 1 1 1|
+-------------------+
f!.0 z
|domain error
| f!.0~z
9!:19]0
f/.~z
+-----+-----+-------+
|0 0 0|0 0 0|0 0 0 0|
+-----+-----+-------+
9!:19]ct
ct
5.68434e_14
f/.~z
+-----+-----+-------+
|1 1 1|1 1 1|1 1 1 1|
+-----+-----+-------+
I am not really sure what /. uses for the comparison tolerance for grouping.
z2=.1 3 2 2 3 1 1 2 2 3+3*ct*?10#0
z2
1 3 2 2 3 1 1 2 2 3
z2=<.z2
1 1 0 0 1 1 1 1 0 1
f z2
+-------------------+
|1 1 0 0 1 1 1 1 0 1|
+-------------------+
f/.~z2
+-----+-----+-------+
|1 1 1|1 1 1|0 0 1 0|
+-----+-----+-------+
Above the numbers close are grouped together as if equal, yet when they are
compared in f they are found to be not tolerably equal.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm