Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

generating all combinations.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22395] generating all combinations.
  • From: d8442803 at student.nsysu.edu.tw (Wen-Feng Hsiao)
  • Date: Sun, 27 Feb 2000 18:55:35 -0500 (EST)
  • Organization: NSYSU
  • Sender: owner-wri-mathgroup at wolfram.com

Dear all,

I would like to generate all the combinations n-digit lists, which can 
vary between a certain range and duplications are allowed. The three 
digits with range between -2 to 2 is the following:

allcomb = 
    Table[{i, j, k}, {i, -2, 2}, {j, -2, 2}, {k, -2, 2}];
fltcomb = Partition[Flatten[allcomb], 3];

Is there a more succinct way to do that? If I would like to expand the 
code to 10 digits, the code would looks clumsy.

Thanks for your help.

Wen-Feng



  • Prev by Date: How to change the default setting of BarChart?
  • Next by Date: Creation of file.m
  • Previous by thread: How to change the default setting of BarChart?
  • Next by thread: Creation of file.m