[Date Index]
[Thread Index]
[Author Index]
Re: Help ! complex permutations
*To*: mathgroup at smc.vnet.net
*Subject*: [mg7054] Re: [mg6965] Help ! complex permutations
*From*: Robert Pratt <rpratt at math.unc.edu>
*Date*: Sat, 3 May 1997 22:04:46 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
I believe the command to use in Mma 2.2.2 was Strings, which now appears to
have been relegated to the Combinatorica standard package in Mma 3.0.
Needs["DiscreteMath`Combinatorica`"]
?Strings
"Strings[l, n] constructs all possible strings of length n from the
elements of list l."
Strings[{a,b},2]
{{a,a},{a,b},{b,a},{b,b}}
Strings[{a,b},3]
{{a,a,a},{a,a,b},{a,b,a},{a,b,b},{b,a,a},{b,a,b},{b,b,a},{b,b,b}}
Rob Pratt
Department of Mathematics
The University of North Carolina at Chapel Hill
CB# 3250, 331 Phillips Hall
Chapel Hill, NC 27599-3250
rpratt at math.unc.edu
http://www.math.unc.edu/Grads/rpratt/
On Wed, 30 Apr 1997, Robert Perkins wrote:
> I need to derive an algorithm, formula, which gives all the
> possiblities, combinations, for any 'n' out of 'm' with the proviso
> that any member of 'm' can be used multiple times and the selection
> sequence is significant.
>
> Taking a trivial example if the input list 'm' is
>
> {a,b}
>
> the output list 'n' for any 2 gives
>
> {a,a},{a,b},{b,a},{b,b}
>
> For an output sequence of 3 from the same input list would give
>
> {a,a,a},{a,a,b},{a,b,b},{b,a,b},{b,b,a},{b,b,b}
>
> Life gets interesting for larger input sequences and ever larger
> output selections. How about the input list containing 10 members and
> the output list containing 20 members with the above rules applying?
>
> Can anyone point me in the right direction? A reference, clue or even
> an algorithm would be very welcome ;)
>
> TIA
>
> Robert_p
>
>
>
Prev by Date:
**Re: Help ! complex permutations**
Next by Date:
**Re: Extracting functions from Solve**
Previous by thread:
**Re: Help ! complex permutations**
Next by thread:
**pattern matching**
| |