Here's a clumsy one that works.

    f =: %`0:@.(0=])"0
    f i. 2 5
   0        1      0.5 0.333333     0.25
 0.2 0.166667 0.142857    0.125 0.111111
    f 0
 0
    f 3j4
 0.12j_0.16

--Kip Murray

Sent from my iPad

> On Oct 11, 2013, at 6:49 AM, Raul Miller <[email protected]> wrote:
> 
> You did not provide a definition for f.
> 
> f=: *%]
> 
> gives me this kind of result:
> 
>   (*%]) i.2 5
>  0        1      0.5 0.333333     0.25
> 0.2 0.166667 0.142857    0.125 0.111111
>   (*%]) 0
> 0
>   (*%]) 3j4
> 0.2j1.77636e_17
> 
> So I'm not sure how you got 0.12j_0.16
> 
> Hints?
> 
> Thanks,
> 
> -- 
> Raul
> 
> 
>> On Fri, Oct 11, 2013 at 2:20 AM, Roger Hui <[email protected]> wrote:
>> I find this example unconvincing as the following achieves the same end
>> much more simply and efficiently.
>> 
>>   f i.2 5
>>  0        1      0.5 0.333333     0.25
>> 0.2 0.166667 0.142857    0.125 0.111111
>>   f 0
>> 0
>>   f 3j4
>> 0.12j_0.16
>> 
>> 
>> 
>> 
>> On Thu, Oct 10, 2013 at 9:48 PM, David Lambert <[email protected]>wrote:
>> 
>>> I don't find examples of "under itemize" in the under essay.  I inserted
>>> an entry " Extend verb domain".
>>> 
>>> 
>>>   reciprocal_or_zero =: =&0`(0,:~%)}   NB. zeros may come from fill
>>> 
>>>   reciprocal_or_zero 8                 NB. OH NO!
>>> |rank error: reciprocal_or_zero
>>> |       reciprocal_or_zero 8
>>> 
>>> 
>>>   (;$) reciprocal_or_zero&.,:8
>>> +-----++
>>> |0.125||
>>> +-----++
>>> 
>>>   (;$) reciprocal_or_zero&.,:i. 2 5
>>> +-----------------------------**----------+---+
>>> |  0        1      0.5 0.333333     0.25|2 5|
>>> |0.2 0.166667 0.142857    0.125 0.111111|   |
>>> +-----------------------------**----------+---+
>>> 
>>> ------------------------------**------------------------------**----------
>>> For information about J forums see 
>>> http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/forums.htm>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to