In connection with using I. to produce histograms I
latched onto an alternative version of I. , Idotr. This I.
alternative seems to produce intervals of the type [) ,
where I. produces intervals of the type (] .

Idotr =: |[EMAIL PROTECTED] ([EMAIL PROTECTED]) ]
sbtb  =: Idotr (+//.)  ]

        Using this definition I get the same result as Don
with
   X sbtb Y
1.32 1.96 0.23 2.62 0.22 0.05 2.29 2.49 0.53

        Btw, I found that it is wise to make sure that the
intervals in X are extended at both ends, which does not
seem to matter in this case.

   (_1,X,2) sbtb Y
1.32 1.96 0.23 2.62 0.22 0.05 2.29 2.49 0.53


On Thu, 26 Apr 2007, Dan Bron wrote:

+ >I believe this will work:
+ >
+ >        sbt =: I.&|. +//. ]
+
+ First, it should've been:
+
+          sbt =: (I.~ |.)~ +//. ]
+
+ Second. I guess the length and order of the results from this is 
data-dependent.
+
+ The following version is much longer and uglier than the original, but 
produces the correct result independent of the length and order of the data, 
and even correctly handles data that is not stricly bounded by  [m,n]  .
+
+          interval =.  (> {:)~ + <:@:#@:[ - (I.~ |.)~
+          range    =.  interval ,~ _1 , i.@:>:@:#@:[
+          values   =.  (,~ 0 #~ 2 + #)~
+          rsums    =.  range +//. values
+          sbt      =:  }.@:}:@rsums f.
+
+ This could be made simpler and more efficient if you guaruntee that your data 
is clamped to  [0,n)  or  (0,n]  (particularly the latter).
+
+ -Dan
+ ----------------------------------------------------------------------
+ For information about J forums see http://www.jsoftware.com/forums.htm
+

(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to