[Jprogramming] Help me using rank (")

Martin Kreuzer info at airkreuzer.com
Tue Jun 14 16:34:04 UTC 2016


Raul -

Thanks for your elaborate answer to my rank question, much appreciated.

I think I've been able to grasp most of it (especially the remark on 
getting rank implicitly).

Your next to last sentence reads, I quote,
"Put differently, we do not need the "1 (from 1 {"1 y) because we get 
an implicit "0 from our use of @ (in 1&{@#:)"

Q: Should this read "... because we get an ** implicit "1 ** from our 
use of ..."..?
If not, then I'm most probably still missing something.

Thanks
-M

At 2016-06-10 18:19, you wrote:
>So, ok, rank... The question, I imagine, is: how does rank help you 
>understand how to get from    1 {"1 (3 5 5 #: i. 3 5 5) 
>to    (1&{@#:i.)3 5 5 But let's try that from another angle. Let's 
>instead unfold the hook, giving us:    3 5 5 (1&{@#: i.) 3 5 5 Here, 
>we can see just a bit more clearly that we are using the dyadic 
>definition of #: And, if we recall 
>http://www.jsoftware.com/help/dictionary/dictb.htm we might remember 
>that the three numbers in rank are:    Monadic rank; Left dyadic 
>rank; Right dyadic rank So, since the rank of #: is _ 1 0, this 
>means its left dyadic rank is 1 and its right dyadic rank is 0. 
>Also, a verb u at v derived using @ has the rank of v. So, 1&{@#: has a 
>left dyadic rank of 1 and a right dyadic rank of zero. Or, thinking 
>about this from a different direction, each rank 1 element of the 
>result of #: was formed based on a left argument of 3 5 5 and a 
>single (rank 0) number from the right argument. Put differently, we 
>do not need the "1 (from 1 {"1 y) because we get an implicit "0 from 
>our use of @ (in 1&{@#:). Put differently, we can often skip using 
>rank because in this case we get its effect implicitly. I hope this 
>helps? Thanks, -- Raul On Fri, Jun 10, 2016 at 1:02 PM, Martin 
>Kreuzer <info at airkreuzer.com> wrote: > Raul - > > So back to square 
>One, totally different approach. (Most of this again for > my 
>reference.) > > I reviewed (x #: y) by the 'time' 
>example > >    hms=. 24 60 60 & #: >    hms 3600 1825 1201 930 > 
>1  0  0 > 0 30 25 > 0 20  1 > 0 15 30 > > Each atom on the right 
>produces a list (3 items each in this case, according > to the given 
>dividers 60 60 24). > > This lead to understanding this 
>structure > >    2 3 #: i.7 > 0 0 > 0 1 > 0 2 > 1 0 > 1 1 > 1 2 > 0 
>0 > > Replacing the right argument list by a table > >    i. 2 3 > 0 
>1 2 > 3 4 5 > >    2 3 #: i. 2 3 > 0 0 > 0 1 > 0 2 > > 1 0 > 1 1 > 1 
>2 > > each table element produced a 2-item-list (2 rows, 2 result 
>blocks). > > Given this table > >    i. 3 3 > 0 1 2 > 3 4 5 > 6 7 
>8 > > one can retrieve the 2nd row or 1st column respectively 
>depending on rank > used on 'From' (x { y): > >    1 {"2 i. 3 
>3   NB. rank 2 gets the row > 3 4 5 >    0 {"1 i. 3 3   NB. rank 1 
>gets the column > 0 3 6 > > If there are several (layout-identical) 
>matrices, it will pick from the same > place in each matrix > >    0 
>{"1 (2 3 #: i. 2 3)   NB. 1st column from each > 0 0 0 > 1 1 1 > > 
>In the original exercise (Bo's question) we would be after the 2nd 
>column: > >    1 {"1 (3 5 5 #: i. 3 5 5)   NB. 2nd column from 
>each > 0 0 0 0 0 > 1 1 1 1 1 > 2 2 2 2 2 > 3 3 3 3 3 > 4 4 4 4 4 > > 
>0 0 0 0 0 > 1 1 1 1 1 > 2 2 2 2 2 > 3 3 3 3 3 > 4 4 4 4 4 > > 0 0 0 
>0 0 > 1 1 1 1 1 > 2 2 2 2 2 > 3 3 3 3 3 > 4 4 4 4 4 > > Going tacid 
>(step by step) I arrived at these lines: > >    1 {"1 (#: i.) 3 5 
>5 >    (1 & {"1 @ #: i.) 3 5 5 > > which is very near to your 
>solutiion > >    (1 & { @ #: i.) 3 5 5 > > (I had a look at (#:"#:) 
>and (#: b.0) but can't figure out the relevance.) > > Q: Why is it 
>that one may skip the rank notation at this time > which had seemed 
>so crucial in the beginning..? > > Thanks > -M > > > At 2016-06-10 
>10:51, you wrote: >> >> Try this:    3 5 5 #: i. 3 5 5 Then try 
>this:    1 {"1 (3 5 5 #: i. 3 5 5) >> Then try this:    #:"#: I hope 
>that helps, Thanks, -- Raul On Fri, Jun 10, >> 2016 at 6:38 AM, 
>Martin Kreuzer <info at airkreuzer.com> wrote: > Raul - > > >> 
>Following this thread, I managed to grasp (reproduce) the expression 
>(0 2 1 >> > |: 3 5 5 $ i. 5) which Bo found satisfactory. > > 
>Challenged by your >> remark "But probably no easier to read." I 
>have tried to > sort of >> reconstruct your approach: > > First I 
>read up on dyadic Antibase (x #: y) >> and found the remainder 
>example; > thus > >    > ,(i. 10) ;(5 #: i. 10) > 0 >> 1 2 3 4 5 6 7 
>8 9 > 0 1 2 3 4 0 1 2 3 4 > > Producing this square matrix > > >> i. 
>5 5 >  0  1  2  3  4 >  5  6  7  8  9 > 10 11 12 13 14 > 15 16 17 18 
>19 > >> 20 21 22 23 24 > > and applying the above I got > >    5 #: 
>i. 5 5 > 0 1 2 3 >> 4 > 0 1 2 3 4 > 0 1 2 3 4 > 0 1 2 3 4 > 0 1 2 3 
>4 > > and (5 #: i. 3 5 5) >> got me three blocks of those. > > 
>Changing the axis preference (?) switched >> rows and 
>columns > >    1 0 |: 5 #: i. 5 5 > 0 0 0 0 0 > 1 1 1 1 1 > 2 2 2 
>2 >> 2 > 3 3 3 3 3 > 4 4 4 4 4 > > and in the case of the three 
>blocks this would >> be written as (0 2 1 |: 5 #: > i. 3 5 5) as the 
>number of blocks remains >> untouched. > > What seemed to me a 
>shortcut for the special case of a >> three-dimensinal > arrangement 
>of square matrices this gives the same >> result: > >    1 |: 5 #: 
>i. 3 5 5 > 0 0 0 0 0 > 1 1 1 1 1 > 2 2 2 2 2 > 3 3 >> 3 3 3 > 4 4 4 
>4 4 > > 0 0 0 0 0 > 1 1 1 1 1 > 2 2 2 2 2 > 3 3 3 3 3 > 4 4 4 >> 4 
>4 > > 0 0 0 0 0 > 1 1 1 1 1 > 2 2 2 2 2 > 3 3 3 3 3 > 4 4 4 4 4 > > 
>Using >> brackets I could write that as >    (1 |: 5 #: i.) 3 5 5 > 
>replacing the (5) >> by grabbing it from the list like (1 { 3 5 5) > 
>I continued to >    (1 |: 1 >> & { #: i.) 3 5 5 > which looked 
>promising. > > It looked to me as you were >> taking advantage of 
>the (1) being mentioned > there twice and therefore >> combining, 
>but ... > Q: Could you enlighten me on this final step..? > > >> 
>Thanks > -M > > > > > At 2016-06-10 06:51, you wrote: >> >> I just 
>stumbled >> across this. It occurs to me that  (1&{@#:i.)3 5 5 
>would >> be one character >> shorter. But probably no easier to 
>read. Thanks, -- Raul On >> Wed, Jun 8, >> 2016 at 5:31 PM, 'Bo 
>Jacoby' via Programming >> <programming at jsoftware.com> >> wrote: > 
>Thanks everyone! > This: >    0 2 1|:3 >> 5 5$i.5 > > produces 
>what >> I wanted. > The result is however destroyed in the >> 
>process of emailing it >> to  programming at jsoftware.com . Line feeds 
>are >> deleted. I don't  know >> why. > Problem is solved. Thanks 
>again. > Bo. > > >> Den 21:10 onsdag den 8. >> juni 2016 skrev Cliff 
>Reiter >> <reiterc at lafayette.edu>: > > > >  Or > ,./": >> 3 5$"1 0 
>i.5 > > 0 0 0 0 01 1 1 >> 1 12 2 2 2 23 3 3 3 34 4 4 4 4 > > 0 0 
>0 >> 0 01 1 1 1 12 2 2 2 23 3 3 3 34 4 4 >> 4 4 > > 0 0 0 0 01 1 1 1 
>12 2 2 2 23 >> 3 3 3 34 4 4 4 4 > > But a strange >> thing to want 
>to build. > > On >> 6/8/2016 1:37 PM, robert therriault wrote: >> >> 
>Maybe this? >> >>      5( 3 >> #  ,:@,@":@:(#/"0)) i. 5 >> 0 0 0 0 
>01 1 1 1 12 >> 2 2 2 23 3 3 3 34 4 4 4 4 >> >> 0 0 0 0 01 1 1 1 12 2 
>2 2 23 3 3 3 34 4 4 4 4 >> >> 0 0 0 0 01 1 1 1 12 2 >> 2 2 23 3 3 3 
>34 4 4 4 4 >> >> But I am confused as >> well about the request >> 
>for a shape 3 5 5 of what appears as a shape 3 45 >> literal matrix. 
>I do >> have '01' in mine though. :-) >> >> Cheers, bob >> >>> >> On 
>Jun 8, 2016, at >> 10:29 AM, Raul Miller <rauldmiller at gmail.com> 
>wrote: >>> >> >>> Did you mean >> something like 
>this? >>> >>>    (<.0.8*1+i.25) 10&#./."1] >> 3#,:5# i.5 >>> >> 0 0 
>0 0 1 1 1 1 12 2 2 2 23 3 3 3 34 4 4 4 4 >>> 0 0 0 0 1 1 >> 1 1 12 2 
>2 2 >> 23 3 3 3 34 4 4 4 4 >>> 0 0 0 0 1 1 1 1 12 2 2 2 23 3 3 3 34 
>4 >> 4 4 4 >>> >> >>> Except, that doesn't get you those leading 
>zeros for the '01' >> column, >> >>> so maybe instead it needs to be 
>character? >>> >>> But a >> character >> array would not have 
>anything to do with that 3 5 5 >>> shape you >> >> suggested, so for 
>that, and guessing what you want, maybe it >>> should be >> >> 
>something like this? >>> >>>    <.25%~i.3 5 5 >>> 0 0 0 0 0 >>> 0 0 
>0 0 0 >> >> >>> 0 0 0 0 0 >>> 0 0 0 0 0 >>> 0 0 0 0 0 >>> >>> 1 1 1 
>1 1 >>> 1 1 1 1 1 >> >> >>> 1 1 1 1 1 >>> 1 1 1 1 1 >>> 1 1 1 1 
>1 >>> >>> 2 2 2 2 2 >>> 2 2 2 2 2 >> >> >>> 2 2 2 2 2 >>> 2 2 2 2 
>2 >>> 2 2 2 2 2 >>> >>> Except that that >> doesn't >> look at all 
>like what you asked for. A 5 3 4 >>> shape gets a >> little 
>closer: >> >>> >>>    <.12%~i.5 3 4 >>> 0 0 0 0 >>> 0 0 0 0 >>> 0 0 
>0 >> 0 >>> >>> 1 1 1 1 >> >>> 1 1 1 1 >>> 1 1 1 1 >>> >>> 2 2 2 
>2 >>> 2 2 2 2 >>> >> 2 2 2 2 >>> >>> 3 3 >> 3 3 >>> 3 3 3 3 >>> 3 3 
>3 3 >>> >>> 4 4 4 4 >>> 4 4 4 >> 4 >>> 4 4 4 4 >>> >>> >> But all of 
>these have conflicts with some aspect of >> your original >>> >> 
>request, and I can't figure out what it is that you >> really 
>wanted. >>> >>> I >> hope this helps? >>> >>> Thanks, >>> >>> 
>-- >>> >> Raul >>> >>> >>> On Wed, Jun >> 8, 2016 at 5:22 AM, 'Bo 
>Jacoby' via >> Programming >>> >> <programming at jsoftware.com> 
>wrote: >>>> Dear J'ers. >>>> >> Please tell me how >> to program the 
>3 5 5 array below. >>>> I am >> experimenting rather than >> 
>understanding. I expect the answer to be quite >> elementary. >>>> 
>Thanks! Bo. >> >>>> >>>> 0 0 0 0 01 1 1 1 12 2 2 2 23 3 3 3 >> 34 4 
>4 4 4 >>>> 0 0 0 0 01 1 1 >> 1 12 2 2 2 23 3 3 3 34 4 4 4 4 >>>> 0 0 
>0 >> 0 01 1 1 1 12 2 2 2 23 3 3 3 34 4 >> 4 4 4 >>>> >>>> >> >> 
>---------------------------------------------------------------------- 
>  >>>> >> >> 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 
>---------------------------------------------------------------------- 
>For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list