I remembered Roger's idiom <. * 0~:*
so that if agenda is redefined using fuzzy <.0
  agenda=: ([ = 0:) +. ((<. * 0~:*) = (>. * 0~:*))@S

   5 res (i:5) + hct
0 1 2 3 4 0 1 2 3 4 0
   5 res (i:5) - hct
0 1 2 3 4 0 1 2 3 4 0

This looks nice.

bill lam wrote:
>> To produce a true zero for cases such as (%3)|(2%3) the residue is made 
>> tolerant as shown in the definition of res below:
>>
>>    res=: [EMAIL PROTECTED]"0
>>       agenda=: ([ = 0:) +. (<. = >.)@S
>>          S=: ] % [ + [ = 0:
>>       f=: ] - [ * <[EMAIL PROTECTED] 
>>       g=: ] * [ = 0:
> 
> I tried
>   0 = ((%3)res(2%3)) - (%3)|(2%3)
> 1
> 
> So I guess monad | is tolerant as implemented. Then I further tried
> 
>    ]hct=: -:9!:18''  NB. half of []ct
> 2.8421709e_14
>    5 | (i:5) + hct
> 0 1 2 3 4 2.8421709e_14 1 2 3 4 0
>    5 | (i:5) - hct
> 0 1 2 3 4 5 1 2 3 4 0
> 
> The results looked unexpected, there are numbers that
> 1. less than []ct  (2.8421709e_14)
> 2. equal tolerantly to the left argument  (5)
> 
> Thanks to Roger for clarifying the case for <.0, ct is becoming interesting. 
> :-)
> 


-- 
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to