Thanks, Fraser, for tracking that down. Yes, that works fine! Vector 19.1 is one of the few editions I don't happen to have. I'm wondering where I got the original copy of Play191 from...
FYI, I note: nimsum ~:/&.#:@,"0/~ NS ~:/&.#: NS 3 6 5 nimsum 3 6 0 5 5 0 ...and so on, for all the args I've tried. So they're not so very different. I guess nimsum is more efficient for calculating the table (a symmetric matrix with 0s down the diagonal) because it provides 2 entries at once. Ian On Tue, Nov 17, 2009 at 9:11 AM, Fraser Jackson <[email protected]> wrote: > In the printed copy (Vector 19.1) it gives > > nimsum =: ~:/&.#:@,"0/~ NB. EEmcD > > That gives the correct results from Mike Day's function. > > Fraser > > ----- Original Message ----- > From: "Ian Clark" <[email protected]> > To: "Programming forum" <[email protected]> > Sent: Tuesday, November 17, 2009 7:27 AM > Subject: Re: [Jprogramming] APWJ Chapter 31: missing object: nimsum > > > I haven't explained the problem well enough. > > Let me try and do so without making suppositions which conceal where > the error actually lies. > > Play191 exhibits a function NS, which calculates a statistic called > the "nim sum" which helps you win at the game of Nim. NS maps into a > domain of numbers which Conway & Guy call "nimbers", with their own > idiosyncratic addition & multiplication. > > Having discussed the addition of nimbers, the paper discusses their > multiplication. It offers two verbs for producing the multiplication > table of nimbers. Both are called mt. I propose to call the one by > Mike Day mtMD, which (quote) "accurately translates" a Maple program > (not shown, but viewable at the OEIS site). > > Now mtMD won't work as it stands, because it uses an entity (verb?) > named nimsum, which is nowhere defined. What is nimsum? > > I conjecture that nimsum is precisely the NS which is defined earlier. > So accordingly I assign: nimsum=: NS > Hey presto, mtMD now works, and it computes the following table: > > mtMD 4 > 0 0 0 0 0 > 0 1 2 3 4 > 0 2 3 3 4 > 0 3 3 3 3 > 0 4 4 3 8 > > However, when you compare it with mt, they don't give the same result, > which I conjecture they should: > > mt 5 NB. (index-origin strikes again!) > 0 0 0 0 0 > 0 1 2 3 4 > 0 2 3 1 8 > 0 3 1 2 12 > 0 4 8 12 6 > > Now in view of the "correct" 15-by-15 multiplication table at the end > of the article, mt is giving the right result but mtMD isn't. > Accordingly I deduce that the assumption: nimsum <--> NS is an unsound > one. So what should the missing verb nimsum really be? > > Ian > > > On Mon, Nov 16, 2009 at 2:31 AM, Henry Rich <[email protected]> wrote: >> To me, nimsum is what you use to solve the game of Nim. It is NS as >> described in the article. A Nim position with nimsum=0 is a loser for >> the player with the move. You calculate it by writing the number of >> stones in the piles in binary, and adding them up in binary, EXCEPT that >> you discard any carries produced during the addition. >> >> You win a Nim game by always making a move that leaves the nimsum=0. It >> is easy to prove that such a move is possible iff the nimsum is not 0 >> already. >> >> Henry Rich >> >> Ian Clark wrote: >>> In: http://www.jsoftware.com/jwiki/Doc/Articles/Play191 (Chapter 31, J >>> be nimble, J be quick) >>> the version of mt attributed to Mike Day fails with value error: nimsum >>> >>> Can anyone see what nimsum is supposed to be? It only occurs once >>> (outside a comment). I've tried equating it to the verb NS, the "nim >>> sum" derived at the start of the article, but although mt then runs, >>> it does not produce the same table as the previous definition of mt >>> (quite apart from needing to be run as (mt 4) not (mt 5) like the >>> previous one). >>> >>> Ian Clark >>> Subeditor, APWJ Edn 2. >>> ---------------------------------------------------------------------- >>> 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
