Hi, this function seems reasonably fast but I think it could be re-arranged to be a bit more compact,
Would anyone have some tips as how to go about this? rg =: 3 : '(y-g) + (r #/. r) (~. r =. ? (+/ g =. y>0)$ $y) } 0 $~ $y' ts 'rg ^:10000 ] 400$100' 0.209447 38272 ts 'rg ^:100000 ] 400$100' 2.10048 38272 Thanks ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm