The production of inverse (more generally, obverse) is described in http://www.jsoftware.com/docs/help701/dictionary/d202n.htm
--Kip Murray Sent from my iPad On May 31, 2013, at 9:15 PM, Henry Rich <[email protected]> wrote: > Roger worked it out & put it into the interpreter. > > Look on his works, ye mighty, and despair. > > Henry Rich > > On 5/31/2013 10:00 PM, elton wang wrote: >> I guess this may deserve a new thread: >> for the inverse of m&|: like >> 3&|: b._1 >> (] |:~ 3 C.^:_1 i.@#@$) :.(3&|:) >> >> How does J find this inverse? is this explicitly coded in J or J >> automatically figures this out by some rules? Either way, this is amazing. >> >> >> ________________________________ >> From: Henry Rich <[email protected]> >> To: [email protected] >> Sent: Friday, May 31, 2013 9:26 PM >> Subject: Re: [Jprogramming] zscore in J either column wise or row wise - >> basic question on rank >> >> >> It looks to me like that's pretty close to working, except that you >> always want to apply v to rows, i. e. rank 1, i. e. >> >> colOrRow =. 2 : ' v"1`(v"1 &.|:)@.m' >> >> but now I must accuse you of incomplete generalization. Suppose the >> operand has higher rank? Isn't what you really want to apply v along a >> given axis? And, come to think of it, shouldn't we allow v to have any >> rank, and apply it to selected axes? I would switch the meanings of u >> and v, and write >> >> onaxes =: 2 : 'u&.(n&|:)' >> >> For rows, you would write >> >> u"1 onaxes 0 >> >> for columns, >> >> u"1 onaxes 1 >> >> You could have >> >> onaxis =: 2 : 'u"1&.(n&|:)' >> >> but I think that's a special case. >> >> Wait a minute... this means you would have to have an inverse of m&|: . >> What would that be? I mean, you would have to take the result, which >> might have any rank, and undo the transpose... how? >> >> 2&|: b. _1 >> (] |:~ 2 C.^:_1 i.@#@$) :.(2&|:) >> 3&|: b. _1 >> (] |:~ 3 C.^:_1 i.@#@$) :.(3&|:) >> >> I can't prove that that's right. But, knowing Roger, I bet it is. >> >> Henry Rich >> >> >> On 5/31/2013 8:35 PM, elton wang wrote: >>> thanks Henry, >>> to generalize the question, how do I define a conjuction colOrRow such that >>> for any verb v: >>> 0 colOrRow v is to apply v along row and combine the results row wise, >>> while 1 colOrRow v is to apply v along column and combine the results >>> column wise? >>> >>> I tried colOrRow =. 2 : ' v`(v"1 &.|:)@.m'. but this is not working. >>> >>> >>> >>> >>> ________________________________ >>> From: Henry Rich <[email protected]> >>> To: [email protected] >>> Sent: Friday, May 31, 2013 8:16 PM >>> Subject: Re: [Jprogramming] zscore in J either column wise or row wise - >>> basic question on rank >>> >>> >>> A good testcase for the new dissect tool! >>> >>> >>> load '~addons/debug/dissect/dissect.ijs' >>> >>> z0 =. (- mean) % stddev >>> z0 i. 3 4 >>> |length error: z0 >>> | z0 i.3 4 >>> >>> what's it doing in there? >>> z0 f. >>> (- (+/ % #)) % %:@(+/@:*:@(-"_1 _ (+/ % #)) % <:@#) >>> >>> run dissect on that: >>> >>> ds '((- (+/ % #)) % %:@(+/@:*:@(-"_1 _ (+/ % #)) % <:@#)) i. 3 4' >>> >>> the display shows that there is agreement error in (- mean). Oh yeah, >>> to work at high rank, you have to put the correct rank on - and % : >>> >>> z0 =. (-"_1 _ mean) %"_1 _ stddev >>> z0 i. 3 4 >>> _1 _1 _1 _1 >>> 0 0 0 0 >>> 1 1 1 1 >>> z0"1 i. 3 4 >>> _1.1619 _0.387298 0.387298 1.1619 >>> _1.1619 _0.387298 0.387298 1.1619 >>> _1.1619 _0.387298 0.387298 1.1619 >>> >>> I don't know if that's correct, but the ranks are right. >>> >>> Henry Rich >>> >>> On 5/31/2013 7:57 PM, elton wang wrote: >>>> if I define zscore as z0 =. (- mean) % stddev, z0 works for rank 1 array. >>>> For a rank 2 array like a=. i. 3 4, if I want to get zscore along either >>>> column or row, I could define >>>> z1 =. [: |: stddev %~ |: - mean >>>> >>>> >>>> z1 i. 3 3 >>>> _1 _1 _1 >>>> 0 0 0 >>>> 1 1 1 >>>> >>>> and >>>> >>>> z1"1 i. 3 3 >>>> _1 0 1 >>>> _1 0 1 >>>> _1 0 1 >>>> >>>> My question is that z1 uses |: twice and looks awkward. If there any >>>> clever way to implement z1 by rank annotation or something? >>>> ---------------------------------------------------------------------- >>>> 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
