[Jprogramming] Complex Number Problems

Martin Kreuzer info at airkreuzer.com
Sat Jul 1 16:31:31 UTC 2017


Agreed.
-M


At 2017-07-01 15:26, you wrote:

>I think the inconsistency you are pointing to here is that r. as a
>verb has a different meaning from r in number formation?
>
>But I think that that's a red herring. For example, e. as a verb has a
>different meaning from e in number formation.
>
>Thanks,
>
>--
>Raul
>
>
>On Sat, Jul 1, 2017 at 7:34 AM, Martin Kreuzer <info at airkreuzer.com> wrote:
> > Looking at (r.) Angle, which is a verb somewhat similar to (j.) Complex, I
> > get
>
> >    2 r. 0.2
> > 1.96013j0.397339
> >    2 r.0.2
> > 1.96013j0.397339
> >    2 r. 2
> > _0.832294j1.81859
> >    2 r.2
> > _0.832294j1.81859
>
> > which all four look fine to me, but are not constistent with (j.)'s
> > behaviour, that's been my point ...
>
> > and then there is this construct
>
> >    2r.2
> > 10
>
> > which doesn't have anything to do with (r.) Angle but is a (fractional)
> > constant of value 2/0.2 showing another instance of .2 being interpreted as
> > 0.2 which is not accepted in other circumstances.
>
> > -M
>
>
> > At 2017-07-01 10:50, you 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 <rhodgkin at me.com>
> >> > > wrote:
> >> > > > Hi Lawrence, the â€Âœill-formed 
> numberâ€Â  is because "j." is ais a
> >> > > > verb,
> >> > > quite different to 
> â€ÂœjÃjâ€Â  which is part of a noun construct
> >> > > (likke 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 ume 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 directrectly 
> using the j notation (as a continuous
> >> > > sequence of non-blank chars)â€Â¦
> >>
> >> > > >    3j4    NBB. 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
> >> > > >> <skippy_lou at hotmail.com>
> >> > > 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
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list