Re: INFORMATIONS
- To: mathgroup at smc.vnet.net
- Subject: [mg17346] Re: [mg17292] INFORMATIONS
- From: BobHanlon at aol.com
- Date: Mon, 3 May 1999 01:45:52 -0400
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 5/1/99 12:36:27 AM, lwpao at tin.it writes: >I am a new "Mathematica" user. >I'm not a mathematician but interested in "Mathematica" possibilities about >combinatory calculations. >I've read the about Help file but I haven't understood how in practice >I can >do it. How to order the computer to do for example this: >input: 3 5 15 22 52 90 >output: show me all the possible combinations for those numbers. >Can you teach me about, showing me step by step what I can do? >My "Mathematica" version is 3.0 and my operative system is Mac OS 8.5 > >I'd like also informations about Italian sites for "Mathematica" and about >combinatorica related to Lottos and Lotteries (also in english). > Giuseppe, selection = {3, 5, 15, 22, 52, 90}; n = Length[selection]; For n numbers, there are n! possible permutations (different orderings). For n =6 that is 6! = 720, i.e., n! == 6! == 720 True Loading the standard add-on package DiscreteMath`Combinatorica` Needs["DiscreteMath`Combinatorica`"] These n! permutations are given by the function MinimumChangePermutations Length[MinimumChangePermutations[selection]] 720 There are n!/(m! * (n-m)!) subsets of these n objects taken m at a time. For example, for n = 6 and m = 2 there are 6!/(2! * 4!) = 15 subsets KSubsets[selection, 2] Length[%] {{3, 5}, {3, 15}, {3, 22}, {3, 52}, {3, 90}, {5, 15}, {5, 22}, {5, 52}, {5, 90}, {15, 22}, {15, 52}, {15, 90}, {22, 52}, {22, 90}, {52, 90}} 15 And @@ Table[Length[KSubsets[selection, m]] == n!/(m! * (n-m)!), {m, 0, n}] True For all possible values of m, there are 2^n such subsets (every possibility where each element is either included or not) Sum[k!/(m! * (k-m)!), {m, 0, k}] == 2^k // FullSimplify True where k was used instead of n since n was given the specific value of 6. Using k shows that the result is true for all values of k including k = n = 6. Bob Hanlon