Looking at word formation is important for understanding this issue:
;:'2 .3 .4 .5'
+-+-+-+-+-+-+-+
|2|.|3|.|4|.|5|
+-+-+-+-+-+-+-+
;:'0.2 0.3 0.4 0.5'
+---------------+
|0.2 0.3 0.4 0.5|
+---------------+
;:'3j.4'
+----+
|3j.4|
+----+
An issue here is that . is a conjunction and passing numbers to it is
invalid (bad syntax). Its domain for its verb arguments does not
include numbers.
That doesn't happen for 3j.4. Meanwhile, if you look at the result:
3j.4
3j0.4
you can see that it makes sense.
Basically, the dot character is a valid part of a number and since
3j.4 begins with a digit, it is being interpreted as a number, and
since . makes sense where it's being used here there's no error.
That would not be the case if the j were replaced with an e because
basically no one uses fractions in the exponent in exponential
notation. Hypothetically, it could be implemented, so that instead of
getting
3e.4
|ill-formed number
you would get
3*10^0.4
7.53566
but since 3e.4 is more likely to be a mistake than something done
intentionally, and since it's easy to catch, it's treated as an error.
Thanks,
--
Raul
On Sat, Jul 1, 2017 at 6:50 AM, bill lam <[email protected]> wrote:
> this is parsed as a token
> ;:'3e.4'
> +----+
> |3e.4|
> +----+
> but it (rightfully?) throws an error
> 3e.4
> |ill-formed number
> this is also parsed as a token
> ;:'3j.4'
> +----+
> |3j.4|
> +----+
> the behavior seems endemic
> 3p.4
> 4.74221
> 3ad.4
> 2.99993j0.0209438
> 3ar.4
> 2.76318j1.16826
> 3x.4
> 4.47547
> 3b.4
> 1.33333
> I think either 3e.4 should be legal or all others should be illegal
> for consistent.
> Сб, 01 иÑл 2017, Martin Kreuzer напиÑал(а):
>> 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â i¬ 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 spacspace
either side to
>> > make it clear to J that this is not â1jxxxâ where J would
assume you
>> > are try 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
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm