[Help Please i need all possible conbinations] - A New Kind of Science: The NKS ForumA New Kind of Science: The NKS Forum
Pages:1
Help Please i need all possible conbinations
(Click here to view the original thread with full colors/images)
Posted by: Romeo
Hi please i would need someone to help me out on this: ( I have two teams in each game( team A and team B) with three possibilities that is a win(1) , a draw(x) or a loss(2).
There are twelve games in total. What are the various combinations possible. while predicting the outcome in all the games and geting them right at thesame time.
I do know that it is a lot of combinations so please if anyone can help me out i would be very greatful please do email it to rummyigho@yahoo.com
Example of combinations required:
If team A Wins in all the twelve matches then one conbination will be 111111111111, another possibility is if team A wins in two matches and Draws in three matches and team b wins in seven matches then then the conbination will be 11XXX2222222.
Please i would be most greatful to anyone that will be able to comeup with all possible combinations. please do email me with your with the conbinations as soon as possible my email address is rummyigho@yahoo.com thanks.
Posted by: Jason Cawley
In Mathematica, you could just type -
Tuples[{0,1,2},12]
You'd get a list of 531441 lists each 12 long, with each element out of the alphabet 0, 1, 2. The total number comes out that way because that is 3^12.
But it is somewhat easier in a simple case like this to just treat each combination as a 12 digit number in base 3. You are just counting through them, from
{0,0,0,0,0,0,0,0,0,0,0} to
{0,0,0,0,0,0,0,0,0,0,1} to
{0,0,0,0,0,0,0,0,0,0,2} to
{0,0,0,0,0,0,0,0,0,1,0} to
{0,0,0,0,0,0,0,0,0,1,1} ...
So you can get any portion of them and uniquely name each one, as -
IntegerDigits[x-1,3,12]
With x running from 1 to 531441. (Or to start at the "zeroth" and go to 531440, just remove that -1).
So, say I wanted the first 100. I'd Map that over Range[100] (which just gives a list from 1 to 100), like this -
IntegerDigits[#-1, 3, 12]&/@Range[100]
When I want the next batch I'd just ask for -
IntegerDigits[#-1, 3, 12]&/@Range[101,200]
You can get the whole lot in one go with Tuples, or with a big Range or a Table. But since that is rather large and unwieldy, for most purposes it will be more useful to get each from its integer "name", as above.
Posted by: Romeo
Thanks for your effort i do appreciate it, but i must tell you i am not good in mathematics and wouldnt know how to go about calculating it.
If you can help me to come up with them (531441 combinations) and please do send them to my email address i will appreciate it i wouldnt mind showing my appreciation by paying a fee.
I will try out the fomular u sent and see how far i can go . my email address is rummyigho@yahoo.com
Posted by: Jason Cawley
Sent, as a 1.3 meg zip of a 20 meg text file.
For those with Mathematica, to send output this large it is a good idea to bypass the front end and not bother displaying the output. So I sent the evaluated form of Tuples to a text file with "Put", like this -
Tuples[{0,1,2},12]>>"combinations.txt"
I hope it is useful.
Forum Sponsored by Wolfram Research
© 2004-2008 Wolfram Research, Inc. | Powered by vBulletin 2.3.0 © 2000-2002 Jelsoft Enterprises, Ltd. |
Disclaimer
vB Easy Archive Final - Created by Xenon and modified/released by SkuZZy from the Job Openings