wolfram mathematica - Combinations with repetition -


i'm using mathematica 7 , combinatorica package function can combinations of number list of elements order doesn't matter , there no repetition.e.g:

in: ksubsets[{a, b, c, d}, 3] out: {{a, b, c}, {a, b, d}, {a, c, d}, {b, c, d}} 

i cannot find function give me combinations of number list of elements order doesn't matter , there is repetition. i.e. above example include elements {a,a,b},{a,a,a},{b,b,b}...etc in output.

it may require custom function. if can come 1 post answer don't see obvious solution.

edit: ideally output not contain duplication of combination e.g. tuples[{a, b, c, d}, 3] return list contains 2 elements {a,a,b} , {b,a,a} combinations point of view same.

deleteduplicates[map[sort, tuples[{a, b, c, d}, 3]]] 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -