load'plot' u=: -: v=: *: Y=: _2 + 0.01 * i.401 f=: 13 :'(] ; [:|:u@v d._2 _1 0 1 2 )y' f ] ; [: |: u@v d._2 _1 0 1 2 plot f Y If this is in a jijs and then run, it will shw the graph you expect bu t it will provide a long J error message in a separate window. I don't know how to prevent it.
Also, maybe when u@v can be replaced by ([:u v)"v that will work also. Linda -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Jose Mario Quintana Sent: Sunday, January 13, 2013 5:17 PM To: [email protected] Subject: Re: [Jprogramming] atop continues to puzzle me To Raul: > I have no idea what "works reasonably well" means. That is a very subjective statement, apparently one can make use of (@) and (@:) within the scope of (d.) but, of course, that depends on one's point of view. > But consider also: > > AT=: 2 :0 > u@v"v > ) > > +:AT*: d. 1 > 0 4x&p."0 0 0 > +:@*: d. 1 > 0 4x&p. This also happens for (at) and I was trying to point it out this difference in my first message: " > Rather works almost exactly? > > ('*'"_) @ ((+: @ *:) (d.1)) (0 1 2) > * > ('*'"_) @ ((+: at *:) (d.1)) (0 1 2) > *** > > ((+: @ *:) (d.1)) b.0 > _ _ _ > ((+: at *:) (d.1)) b.0 > 0 0 0 " However, (d.) also treats differently (at) and (AT)! (See below.) > > In both cases the rank of the left argument of d. is the same. So what > we see here is that the rank of the result of d. depends on something > other than the rank of its arguments. Have you found any documentation > that describes the rank of the results of the d. > conjunction? No, hence the words "seems arbitrary" in > and (@:) works reasonably well, although the rank change from 0 to _ > seems arbitrary, but it stumbles for (at) and ([:), To Linda: > Jose, I'm working on your plot program and I found a ray of hope... Raul's (AT), unlike (at), does the job of plotting the functions: plot @: (] ; |: @: ((u AT v) d. _2 _1 0 1 2)) Y although in a different fashion, at least for the fixed version according to the interpreter: plot @: (] ; |: @: ((u AT v)f. d. _2 _1 0 1 2)) Y plot @: (] ; |: @: ((u @ v)f. d. _2 _1 0 1 2)) Y (u AT v)f. d. _2 _1 0 1 2 (0 0 0 0 1r24&p."0 0 0 , 0 0 0 1r6&p."0 0 0 , -:@*:"0 0 0 , ["0 0 0 , 1"0"0 0 0)"0 (u @ v)f. d. _2 _1 0 1 2 (0 0 0 0 1r24&p. , 0 0 0 1r6&p. , -:@*: , [ , 1"0)"0 Although so far it has not been confirmed, there is plenty of evidence that (d.) attracted some bugs; Raul's (at) and ([:) do not work well in this context but they should have worked. It seems to me that you would like to use (2 : '([: u v)"v') instead of (@) because the former is more clear to you. But I would like to second Henri's advice, if you understand (2 : '([: u v)"v') then you understand (@). Why would you like then to use a long hand, so to speak, instead of a short hand (besides, as this thread shows, (@) is more reliable)? Similar comments, but to lesser extent, apply to ([:) vs. (@:). ________________________________________________________________________ On Sun, Jan 13, 2013 at 12:06 PM, Raul Miller <[email protected]> wrote: > On Sun, Jan 13, 2013 at 10:26 AM, Linda Alvord <[email protected]> wrote: >> It seems to need d."0 but I can't seem to figure how to do it. > > You can use "0 on the result of d. For example: > > (d. 1) (" 0) > > I do not think you should have to do this, but it works. > > -- > Raul > ---------------------------------------------------------------------- > 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
