#I.0=(iscomplex=isnotreal)1 j. -:^:a:1
1030

So, for example:

   (iscomplex=isnotreal)1j1e_99
0

Basically, the epsilon used for tolerant equality is much coarser than
the ratio of real to imaginary which is possible in J's complex
representation.

Thanks,

-- 
Raul

On Sat, Nov 29, 2014 at 11:22 PM, Henry Rich <[email protected]> wrote:
> Two ways of detecting complex numbers have been suggested:
>
>    iscomplex =. 0 ~: 11&o.
>    isnotreal =. ~:~ +
>
> They are not equivalent.
>    iscomplex a
> 1
>    isnotreal a
> 0
>
> What is an example for the finite number a?
>
> Henry Rich
>
> On 11/29/2014 10:20 PM, Linda Alvord wrote:
>>
>> \Very nice.  Or, if it has a different conjugate it must be complex.
>> Linda
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Lippu Esa
>> Sent: Saturday, November 29, 2014 4:37 PM
>> To: '[email protected]'
>> Subject: Re: [Jprogramming] Better way to locate coomplex or real numbers
>> in
>> an array
>>
>> A real number equals its conjugate, so (~:+) works too:
>>
>>      ]A=:(i:2)j./i:2
>> _2j_2 _2j_1 _2 _2j1 _2j2
>> _1j_2 _1j_1 _1 _1j1 _1j2
>>    0j_2  0j_1  0  0j1  0j2
>>    1j_2  1j_1  1  1j1  1j2
>>    2j_2  2j_1  2  2j1  2j2
>>      (~:+) A
>> 1 1 0 1 1
>> 1 1 0 1 1
>> 1 1 0 1 1
>> 1 1 0 1 1
>> 1 1 0 1 1
>>
>> Esa
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Henry Rich
>> Sent: 29. marraskuuta 2014 05:34
>> To: [email protected]
>> Subject: Re: [Jprogramming] Better way to locate coomplex or real numbers
>> in
>> an array
>>
>>      ]A=:(i:2)j./i:2
>> _2j_2 _2j_1 _2 _2j1 _2j2
>> _1j_2 _1j_1 _1 _1j1 _1j2
>>    0j_2  0j_1  0  0j1  0j2
>>    1j_2  1j_1  1  1j1  1j2
>>    2j_2  2j_1  2  2j1  2j2
>>      (0 ~: 11&o.) A
>> 1 1 0 1 1
>> 1 1 0 1 1
>> 1 1 0 1 1
>> 1 1 0 1 1
>> 1 1 0 1 1
>>
>> Henry Rich
>>
>> On 11/28/2014 10:27 PM, Linda Alvord wrote:
>>>
>>> A is an array of real and complex numbers.  Is there an easier way to
>>> locate all the complex numbers.  Signum locates each numbers
>>> intersection with a line from it to the origin and the circle.
>>>
>>>
>>>
>>>      ]A=:(i:2)j./i:2
>>>
>>> _2j_2 _2j_1 _2 _2j1 _2j2
>>>
>>> _1j_2 _1j_1 _1 _1j1 _1j2
>>>
>>> 0j_2 0j_1 0 0j1 0j2
>>>
>>> 1j_2 1j_1 1 1j1 1j2
>>>
>>> 2j_2 2j_1 2 2j1 2j2
>>>
>>>
>>>
>>>      *A
>>>
>>> _0.707107j_0.707107 _0.894427j_0.447214 _1 _0.894427j0.447214
>>> _0.707107j0.707107
>>>
>>> _0.447214j_0.894427 _0.707107j_0.707107 _1 _0.707107j0.707107
>>> _0.447214j0.894427
>>>
>>> 0j_1 0j_1 0 0j1 0j1
>>>
>>> 0.447214j_0.894427 0.707107j_0.707107 1 0.707107j0.707107
>>> 0.447214j0.894427
>>>
>>> 0.707107j_0.707107 0.894427j_0.447214 1 0.894427j0.447214
>>> 0.707107j0.707107
>>>
>>>
>>>
>>>      -.(*A)e. _1 0 1
>>>
>>> 1 1 0 1 1
>>>
>>> 1 1 0 1 1
>>>
>>> 1 1 0 1 1
>>>
>>> 1 1 0 1 1
>>>
>>> 1 1 0 1 1
>>>
>>>
>>>
>>> I am looking for the best way to locate all the complex numbers.
>>>
>>>
>>>
>>> Linda
>>>
>>> ----------------------------------------------------------------------
>>> 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
>>
>> ----------------------------------------------------------------------
>> 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