Yes, you want 3!7 (the dyadic form of !). You'll find that a lot of J primitives are designed so that their monadic and dyadic valences are thematically related, and frequently their spelling is mnemonic (or at least suggestive) as well.
-Dan ----- Original Message --------------- Subject: [Jprogramming] Combinatorial Maths with J From: Jon Hough <[email protected]> Date: Wed, 26 Feb 2014 15:25:31 +0000 To: "[email protected]" <[email protected]> I have a question about doing combinations and permutations with J. There is an easy to use factorial function (or is that verb) : ! !5120 Is there a combination verb? Or do I make my own? ((!3)*!(7-3))%~!7 Gives 7 choose 3. I think I butchered that. Is there a better way to do this, without all the brackets? Now I want to think about more complicated combinatorial objects: Steiner Systemshttp://en.wikipedia.org/wiki/Steiner_system Essentially a Steiner System is defined by three numbers a,b,c such that we have a total of c points and we collect the points into subsets of size b, such that for any "a" points (where a < b < c) there is exactly one subset containing all three:example a,b,c=2,3,7 we have the S(2,3,7) steiner system with points 0~6, the subsets are012 034 056 135 146 236 245Note, every pair of points is in exactly one subset. For a given Steiner system, to calculate the number of subsets (in the above case 7) there is a simple eqn: num = (c choose a)/(b choose a) I would like to write this as a verb (preferrably tacit).I have immediately run into a problem:this verb would take three arguments. Not sure how to do that. I would like some help writing this verb. Thanks in advance. Regards,Jon ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
