A few notes...

0j is giving you the ill formed number diagnostic. A reference
document is at http://www.jsoftware.com/help/dictionary/dcons.htm but
syntactically, the use of j in a number should follow the same pattern
as using e in a number. You don't say 10e and similarly you don't say
10j ...

1j. is a similar problem, but different. Here, j. is a word, and if
you glue other characters to the j you get a different word. And, as
it happens, the word (1j.) does not have a definition. If you want a
decimal point you'll need to put some digits to the left of it.

If you want to experiment with word forming rules, ;: is the primitive
which does word forming.

So, for example, you could look at the result from ;:'0j(2^0.5)%2' and
see where the word boundaries are. (You can also use the dissect tool,
but that goes into a lot more detail about a lot of other issues.)

As for your length error - you tried to add a two element vector to a
four element vector and those lengths do not match. You could extend
the short one if you wanted their lengths to match. Or, you could
specify something else (like outer product) if you wanted something
else...

Here's a couple variations on your sentences which do something which
may or may not be what you intended (I'll let you try them out):

   0j0,(2^0.5)%2  NB. use , to join computed values into a list
   0j0,((2^0.5)%2)
   1 j.(2^0.5)%2
   +1 j.(2^0.5)%2  NB. + used this way is complex conjugate
   1j0,(2^0.5)%2
   k=:(0 1 0 0 0+j.(2^0.5)%2 3 4 0 5)
   k=:(0,(1+j.(2^0.5)%2), 3 4 0 5)
   k=:(0, g, 3 4 0 5)

And if any of those are at all close to what you are looking for, you
might want to look at the word formation rules, for example:
   ;:'k=:(0, g, 3 4 0 5)'

That said, if there was some particular thing you were trying to do
which none of us here have managed to suggest, we could also try a
"describe what you are trying for" thing...

Thanks,

-- 
Raul


On Fri, Jun 30, 2017 at 11: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

Reply via email to