> 0j1 is complex. Why not 1j0? datatype 100000000000000000000000x 1j0 |ill-formed number
Maybe I do not understand your question? Or maybe you really meant to respond to something else? Thanks, -- Raul On Fri, Nov 22, 2019 at 4:17 PM Skip Cave <[email protected]> wrote: > > 0j1 is complex. Why not 1j0? > We try an experiment: > > ea=. each > > > NB. Generate a series of complex integers in text: > > ({'1j'),ea":ea i:3 > > │1j_3│1j_2│1j_1│1j0│1j1│1j2│1j3│ > > > NB. Convert the text to complex numbers: > > ".ea({'1j'),ea":ea i:3 > > │1j_3│1j_2│1j_1│1│1j1│1j2│1j3│ > > > NB. Find the datatypes: > > datatype ea".ea({'1j'),ea":ea i:3 > > │complex│complex│complex│integer│complex│complex│complex│ > > > So the datatype can change in the vector > > > NB. On the other hand: > > NB. Generate a series of mixed integer & floating point numbers: > > 5,0,10%i:3 > > 5 0 _3.33333 _5 _10 _ 10 5 3.33333 > > > NB. Find the datatypes: > > datatype ea 5,0,10%i:3 > > │floating│floating│floating│floating│floating│floating│floating│floating│floating│ > > > NB. Hmmm. seems like there should be some integers in the datatypes > > NB. Take the floors (all integers) > > >. 5,0,10%i:3 > > 5 0 _3 _5 _10 _ 10 5 4 > > > NB. Find the datatypes of the floored vector (should be all integers): > > datatype ea >.5,0,10%i:3 > > │floating│floating│floating│floating│floating│floating│floating│floating│floating│ > > > According to the first example, the datatypes should change if the types > change to integer in the vector. > > If we take the floor, all the results should be integer. > > > Seems like J should be more regular and predictable in its treatment of > datatypes. > > Skip Cave > > > > On Fri, Nov 22, 2019 at 2:12 PM Raul Miller <[email protected]> wrote: > > > I think it's partially a matter of implementation convenience. > > > > Note, also, that J currently does not support gaussian integers except > > for those which can be represented using ieee-754 64 bit binary > > floating point, and: > > > > datatype 100000000000000000000000x 1 > > extended > > datatype 100000000000000000000000x 1j0 > > |ill-formed number > > > > Thanks, > > > > -- > > Raul > > > > On Fri, Nov 22, 2019 at 12:44 PM Skip Cave <[email protected]> > > wrote: > > > > > > So the question is still: why not simply always store 1j0 as a complex > > type > > > internally? > > > What is preventing the J interpreter J from detecting 1j0, and storing it > > > internally as a complex value?: > > > > > > datatype 1j0 > > > complex > > > > > > ????? > > > > > > Skip Cave > > > Cave Consulting LLC > > > > > > > > > On Fri, Nov 22, 2019 at 11:36 AM Don Guinn <[email protected]> wrote: > > > > > > > datatype{.0 1j1 > > > > complex > > > > > > > > On Fri, Nov 22, 2019, 10:29 AM Skip Cave <[email protected]> > > wrote: > > > > > > > > > datatype >.1j0 1j1 > > > > > > > > > > complex > > > > > > > > > > datatype 1j0 1j0 > > > > > > > > > > integer > > > > > > > > > > > > > > > Why not just always store 1j0 internally as a complex type? 1j1 gets > > > > stored > > > > > as compex. > > > > > Skip Cave > > > > > Cave Consulting LLC > > > > > > > > > > > > > > > On Fri, Nov 22, 2019 at 10:58 AM Raul Miller <[email protected]> > > > > > wrote: > > > > > > > > > > > (1 j.0) would be one way of writing a constant that produces a > > complex > > > > > > precision with imaginary part 0. > > > > > > > > > > > > Thanks, > > > > > > > > > > > > -- > > > > > > Raul > > > > > > > > > > > > On Fri, Nov 22, 2019 at 5:20 AM Henry Rich <[email protected]> > > > > wrote: > > > > > > > > > > > > > > 1/ Because the decoration comes before the value, it was easier > > to > > > > put > > > > > > > the 0 at the beginning of the display. That's a weak argument, > > but > > > > > > > that's why I did it that way. > > > > > > > > > > > > > > 2/ I was just thinking about this last night. You're right, for > > > > > > > consistency complex values should be decorated. But the point > > of the > > > > > > > decoration is to have a linear form that faithfully reproduces > > the > > > > > > > value. 1j0 does not produce a complex value. Before the > > decoration, > > > > > we > > > > > > > need to agree on a way to write a constant that produces a > > complex > > > > > > > precision with imaginary part 0. > > > > > > > > > > > > > > 3/ I defer to Bill on this. > > > > > > > > > > > > > > Henry Rich > > > > > > > > > > > > > > On 11/22/2019 1:04 AM, Kirk Iverson wrote: > > > > > > > > A recent thread in the programming forum (00 strange?) > > inspired me > > > > to > > > > > > look at this new behaviour in 901. > > > > > > > > > > > > > > > > NB. Numeric > > > > > > > > datatype&.> 'b i f x c'=. 0 1;(0 1+0);(0 1%1);0 > > 1x;0,1j1-0j1 > > > > > > > > +-------+-------+--------+--------+-------+ > > > > > > > > |boolean|integer|floating|extended|complex| > > > > > > > > +-------+-------+--------+--------+-------+ > > > > > > > > b&+ > > > > > > > > 0 1&+ > > > > > > > > i&+ > > > > > > > > 00 1&+ <== (1) > > > > > > > > f&+ > > > > > > > > 0 1.&+ > > > > > > > > x&+ > > > > > > > > 0 1x&+ > > > > > > > > c&+ > > > > > > > > 0 1&+ <== (2) > > > > > > > > > > > > > > > > > > > > > > > > NB. Character > > > > > > > > d=. (0{a.);'abc' > > > > > > > > 'lctrl lascii'=. d > > > > > > > > 'uctrl uascii'=. u:&.> d > > > > > > > > 'Uctrl Uascii'=. 10 u:&.> d > > > > > > > > datatype&.>lctrl;lascii;uctrl;uascii;Uctrl;Uascii > > > > > > > > +-------+-------+-------+-------+--------+--------+ > > > > > > > > |literal|literal|unicode|unicode|unicode4|unicode4| > > > > > > > > +-------+-------+-------+-------+--------+--------+ > > > > > > > > lctrl&, > > > > > > > > (00{a.)&, > > > > > > > > lascii&, > > > > > > > > 'abc'&, > > > > > > > > uctrl&, > > > > > > > > (u: 00)&, > > > > > > > > uascii&, > > > > > > > > (u: 97 98 99)&, <== (3) > > > > > > > > Uctrl&, > > > > > > > > (10&u: 00)&, > > > > > > > > Uascii&, > > > > > > > > (10&u: 97 98 99)&, <== (3) > > > > > > > > > > > > > > > > > > > > > > > > 1/ Is there a reason that it is the first element of an integer > > > > array > > > > > > which has extra decoration, rather than the last element (as in the > > > > other > > > > > > cases)? > > > > > > > > > > > > > > > > 2/ Shouldn't this display as 0 1j0&+ ? > > > > > > > > Also, when interpreting constants in a line of J: > > > > > > > > 0 1 is boolean > > > > > > > > 00 1 is integer > > > > > > > > 0 1. is floating > > > > > > > > 0 1x is extended (as is 0 1r1) > > > > > > > > 0 1j0 is integer > > > > > > > > Shouldn't this last one be complex? > > > > > > > > > > > > > > > > 3/ Can the representations of uascii and Uascii make use of > > > > literals > > > > > > (like lascii does)? > > > > > > > > > > > > > > > > /K > > > > > > > > > > > > > > > ---------------------------------------------------------------------- > > > > > > > > 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 > > > > > > > ---------------------------------------------------------------------- > > > 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
