Looking at the examples, I came across the difference between

   3 j. 4      NB. spaces
3j4

and

   3j.4      NB. no spaces
3j0.4

Given that this (rightfully) throws an error

   .2 .3 .4 .5
|syntax error
|        .2 .3 .4 .5

 while this doesn't

   0.2 0.3 0.4 0.5
0.2 0.3 0.4 0.5

why then is the construct  3j.4 valid..?

-M


At 2017-07-01 04:43, you wrote:

> As Henry points out, the NuVoc page is quite a bit clearer on this topic.

Sample google search:
   site:jsoftware.com inurl:nuvoc complex

Quite a bit of reading there, if you have the patience for it (be sure
to mix in plenty of trial and error, though, or it's a total snoozer).

Thanks,

--
Raul


On Fri, Jun 30, 2017 at 11:30 PM, Rob Hodgkinson <[email protected]> wrote:
> Hi Lawrence, the “ill-formed number” is because "j." is a verb, quite different to “j” which is part of a noun construct (like 3j4, or 1e3 for 1000).

> So in your examples ...

> NB. But wait, not so fast:
>   1j.(2^0.5)%2
> |ill-formed number
> NB. No

> NB. Now try to separate the “j.” verb with a space either side to make it clear to J that this is not “1jxxx” where J would assume you are trying to make a complex constant.
>    1 j. (2^0.5)%2
> 1j0.707107

> The reason is that J can also directly interpret ‘complex constants’ entered directly using the j notation (as a continuous sequence of non-blank chars)…
>    3j4    NB. This is a single complex constant 3+i4
> 3j4

> 3 j4 NB. But now J tries to view this as a list of (3) and (j4) which which J would assume is (3) and a variable called (j4).
> |syntax error
> | 3 j4

> As Henry points out, the NuVoc page is quite a bit clearer on this topic.

> HTH, Regards Rob


>> On 1 Jul 2017, at 1:14 pm, Lawrence Wickert <[email protected]> wrote:
>>
>> Hello, I am a old EE still trying to learn. I am a real beginner having no end of problems with specifying complex numbers. I am using j64-804 on ubuntu 12.04. I am either doing something really stupid or I need to update to 806. Updating anything gives me heartburn or worse so I hope it is just my misunderstanding of basic principles. Although I have a bad habit of RTFM as a last resort I have tried the Dictionary to no avail. I appreciate any guidance.
>>
>>   0j(2^0.5)%2
>> |ill-formed number
>>
>>   0j((2^0.5)%2)
>> |ill-formed number
>>
>>   j.(2^0.5)%2
>> 0j0.707107
>> NB. Eureaka, OK, I get it!
>>
>> NB. But wait, not so fast:
>>   1j.(2^0.5)%2
>> |ill-formed number
>> NB. No
>>
>>   1j(2^0.5)%2
>> |ill-formed number
>> NB. Still No
>>
>>   1+j.(2^0.5)%2
>> 1j0.707107
>> NB. This works!
>>
>> Let's try to do something with it:
>>   k=:(0 1+j.(2^0.5)%2 3 4 0 5)
>> |length error
>> |   k=:(0 1    +j.(2^0.5)%2 3 4 0 5)
>>
>> NB. Maybe parantheses will help:
>>   k=:(0 (1+j.(2^0.5)%2) 3 4 0 5)
>> |syntax error
>> |   k=:(    0(1+j.(2^0.5)%2)3 4 0 5)
>>
>> NB. This one has to work:
>>   k=:(0 1j0.7071 3 4 0 5)
>>   k
>> 0 1j0.7071 3 4 0 5
>> NB. It does but it can't be the only way to do it.
>>
>> NB. One last rry:
>>   g=: 1+j.(2^0.5)%2
>>   g
>> 1j0.707107
>> NB. That's nice.
>>
>>   k=:(0 g 3 4 0 5)
>> |syntax error
>> |   k=:(    0 g 3 4 0 5)
>> NB. This isn't nice.
>>
>> Lost in the high desert of New Mexico, Larry Wickert
>>
>> ----------------------------------------------------------------------
>> 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