From: Dr. Bruno Campanini on 23 May 2010 03:17 Subsets[Range[90],{5}] should print all the Binomial[90,5] = 43 949 268 combinations. On my PC (4gb RAM) Mathematica 7.0 claims "Not enough memory". By the way, I only need to print some thousands of these combinations, then Subsets[Range[90],{5}, 3000] works fine. But it prints the first 3000 combination in lexicographic order. How to get 3000 random out of 43 949 268, not ordered? Bruno
From: M.Roellig on 23 May 2010 07:20 Hi, You could use RandomSample RandomSample[Subsets[Range[90], {5}], 3000] Cheers, Markus On 23 Mai, 09:17, "Dr. Bruno Campanini" <cmp...(a)gmail.com> wrote: > Subsets[Range[90],{5}] should print all the > Binomial[90,5] = 43 949 268 combinations. > > On my PC (4gb RAM) Mathematica 7.0 claims > "Not enough memory". > > By the way, I only need to print some thousands > of these combinations, then Subsets[Range[90],{5}, 3000] > works fine. > But it prints the first 3000 combination in lexicographic > order. How to get 3000 random out of 43 949 268, not > ordered? > > Bruno
From: Ray Koopman on 23 May 2010 07:20 On May 23, 12:17 am, "Dr. Bruno Campanini" <cmp...(a)gmail.com> wrote: > Subsets[Range[90],{5}] should print all the > Binomial[90,5] = 43 949 268 combinations. > > On my PC (4gb RAM) Mathematica 7.0 claims > "Not enough memory". > > By the way, I only need to print some thousands > of these combinations, then Subsets[Range[90],{5}, 3000] > works fine. > But it prints the first 3000 combination in lexicographic > order. How to get 3000 random out of 43 949 268, not > ordered? > > Bruno This has a 90% chance of Length[s] being 3000. It's very fast. Just keep trying until you get it. Dimensions[s = Union(a)Table[Sort(a)RandomSample[Range(a)90,5],{3000}]]
From: Patrick Scheibe on 23 May 2010 07:20 Hi, data = RandomSample[Subsets[Range[90], {5}], 3000]; works fine here: "7.0 for Linux x86 (64-bit) (February 18, 2009)" Cheers Patrick On Sun, 2010-05-23 at 03:17 -0400, Dr. Bruno Campanini wrote: > Subsets[Range[90],{5}] should print all the > Binomial[90,5] = 43 949 268 combinations. > > On my PC (4gb RAM) Mathematica 7.0 claims > "Not enough memory". > > By the way, I only need to print some thousands > of these combinations, then Subsets[Range[90],{5}, 3000] > works fine. > But it prints the first 3000 combination in lexicographic > order. How to get 3000 random out of 43 949 268, not > ordered? > > Bruno >
From: Scott Hemphill on 25 May 2010 06:32 Patrick Scheibe <pscheibe(a)trm.uni-leipzig.de> writes: > Hi, > > data = RandomSample[Subsets[Range[90], {5}], 3000]; > > works fine here: "7.0 for Linux x86 (64-bit) (February 18, 2009)" Yes, I have the same version. After execution, MathKernel was using 3505MB of virtual memory. Scott > On Sun, 2010-05-23 at 03:17 -0400, Dr. Bruno Campanini wrote: >> Subsets[Range[90],{5}] should print all the >> Binomial[90,5] = 43 949 268 combinations. >> >> On my PC (4gb RAM) Mathematica 7.0 claims >> "Not enough memory". >> >> By the way, I only need to print some thousands >> of these combinations, then Subsets[Range[90],{5}, 3000] >> works fine. >> But it prints the first 3000 combination in lexicographic >> order. How to get 3000 random out of 43 949 268, not >> ordered? >> >> Bruno >> > > -- Scott Hemphill hemphill(a)alumni.caltech.edu "This isn't flying. This is falling, with style." -- Buzz Lightyear
|
Next
|
Last
Pages: 1 2 Prev: Intersection of sublists on date and making a 2D list from a 3D Next: Dot product confusion |