More thoughts on the problem:

   a=:i.5
   a j. 0
0 1 2 3 4

If you make complex numbers, they should stay as complex numbers!

If you don't want them, you have to take some action to undo them.

What if the result above was 
    
   c=:0j0 1j0 2j0 3j0 4j0
   
    a-:c
1

One is a real and the other is complex so the result should be  0

Once you are in the complex plane you stay there until you chose to leave.
   
   j.i.5
0 0j1 0j2 0j3 0j4
   j.j.i.5
0 _1 _2 _3 _4
   j.j.j.i.5
0 0j_1 0j_2 0j_3 0j_4
   j.j.j.j.i.5
0 1 2 3 4
   
The second and fourth results would be better as

0j0 _1j0 _2j0 _3j0 _4j0
and
0j0 1j0 2j0 3j0 4j0   

Even if you look at c, it gets turned into reals and maybe  you don't want them.
   
   c=:0j0 1j0 2j0 3j0 4j0
   c
0 1 2 3 4

I don't quite know how you would indicate you want to convert the complex 
numbers to real.

Linda

-----Original Message-----
From: programming-boun...@jsoftware.com 
[mailto:programming-boun...@jsoftware.com] On Behalf Of Linda Alvord
Sent: Sunday, January 22, 2012 6:01 AM
To: 'Programming forum'
Subject: Re: [Jprogramming] 5|0 1 2 3 4 is not equal to 5|0 1 2 3 4 j.0

   NB. j. y  ↔  0j1 * y 
   NB.   x j. y  ↔  x + j. y 
   
   f=: 13 :'5|y'
   f
5 | ]
 
   f 4
4
   4 j. 0 
4
   f 4 j. 0
_1

It seems to me that the code for  j.  fails to recognize that an entire array 
of numbers has right arguments of 0 and it should then convert the array to 
"real numbers". If it did that match would be correct. If match compares 
numbers it must check that both are real or both are imaginary.

Probably this is incredibly naïve, but those issues seems to be the problem.

Linda


Original Message-----
From: programming-boun...@jsoftware.com 
[mailto:programming-boun...@jsoftware.com] On Behalf Of David Mitchell
Sent: Sunday, January 22, 2012 4:42 AM
To: Programming forum
Subject: Re: [Jprogramming] 5|0 1 2 3 4 is not equal to 5|0 1 2 3 4 j.0

It also seems similar to this thread:

http://jsoftware.com/pipermail/programming/2011-December/026261.html


On 1/22/2012 4:23, Ian Clark wrote:
> This has similarities to the issues discussed in:
>    http://jsoftware.com/pipermail/programming/2011-July/023384.html
>
> On Sun, Jan 22, 2012 at 8:40 AM, Bo Jacoby<bojac...@yahoo.dk>  wrote:
>> Equal arguments should give equal function values, but not here.
>>
>>     a=.i.5
>>     b=.a j. 0
>>     f=. 5&|
>>     a-:b
>> 1
>>     (f a)-:(f b)
>> 0
>>
>>     f a
>> 0 1 2 3 4
>>     f b
>> 0 1 2 _2 _1
>>
>> -Bo
>> ----------------------------------------------------------------------
>> 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