Thank you very much for your suggestion, however I'm can't see quite how it would be applied... I thought at first you meant to replace p i. " 1 0 >./ " 1 p but your expression is not equivalent:
] p =: ? 3 2 $ 0 0.675376 0.616793 0.571841 0.705857 0.622286 0.188883 p i. " 1 0 >./ " 1 p 0 1 0 ((<:/"1)-: (i. " 1 0 >./ " 1)) p 1 Ali ----- Original Message ---- From: R.E. Boss <[EMAIL PROTECTED]> To: Programming forum <[email protected]> Sent: Monday, 9 October, 2006 2:03:24 PM Subject: RE: [Jprogramming] Minority Game A minor remark, which makes bid some 30% faster: ((<:/"1)-: (i. " 1 0 >./ " 1))p NB. in bid 1 R.E. Boss -----Oorspronkelijk bericht----- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Alistair Tucker Verzonden: maandag 9 oktober 2006 11:51 Aan: Programming forum Onderwerp: Re: [Jprogramming] Minority Game Forgot to say - it might take a minute or so to run, but you do get an interesting graph at the end! ----- Original Message ---- From: Alistair Tucker <[EMAIL PROTECTED]> To: Programming forum <[email protected]> Sent: Monday, 9 October, 2006 10:45:15 AM Subject: [Jprogramming] Minority Game Hi people Don't know if any of you have come across the minority game before? This is my first J program, and much to my surprise it seems to work! I do have a couple of questions though: I have used quite a few rank conjunctions " in here, I wonder is that perfectly hunky-dory or does it mean that I have set it up badly? Also the central function 'bid' modifies global variable p on each iteration, which doesn't strike me as being very 'functional'. Is there a better way to deal with this? I'm quite liking J! The best thing is that anyone looking over my shoulder won't have the faintest idea what I'm doing, and I can pretend it's something to do with work :) Ali N =: 4097 NB. number of agents M =: 5 NB. length of history S =: 2 NB. strategies per agent R =: _1 + 2 * ? ((2 ^ M) , N , S) $ 2 NB. strategy look-up tables (frozen disorder) p =: +/ _0.5 + ? (12 , N , S) $ 0 NB. initial performance figures (approximately Gaussian) A =: +/ _0.5 + ? (12 , M + 1) $ 0 NB. initial time sequence (approximately Gaussians) bid =: 3 : 0 p =: p - ({: y) * (#. 0.5 * 1 + * }: (- >: M) {. y) { R b =. (p i. " 1 0 >./ " 1 p) { " 0 1 (#. 0.5 * 1 + * (- M) {. y) { R y , (+/ b) % %: N ) L =: (_160 + i. 320) % 4 U =: (_159 + i. 320) % 4 cum =: 3 : '+/ (y > " 0 1 L) *. (y < " 0 1 U)' load 'plot' plot (0.5 * L + U) ; cum (bid ^: (2 ^ 14)) A www.see.eclipse.co.uk ___________________________________________________________ The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ___________________________________________________________ Inbox full of spam? Get leading spam protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ___________________________________________________________ The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
