[SciPy-user] Finding all combinations of numbers

David Warde-Farley dwf@cs.toronto....
Sat Jan 12 22:21:26 CST 2008


Looks like I spoke too soon: SAGE apparently contains an implementation for any iterable object.

http://sage.scipy.org/sage/doc/html/ref/module-sage.misc.misc.html

Again you'll likely need to remove the empty list.

(Apologies if a truncated version of this message appears, my hand slipped and I'm not sure I cancelled it in time)

DWF


-----Original Message-----
From: Roger Herikstad <roger.herikstad@gmail.com>
Sent: January 12, 2008 7:46 PM
To: SciPy Users List <SciPy-user@scipy.org>
Subject: [SciPy-user] Finding all combinations of numbers

Hi all, I was wondering if there is a functions in scipy for generating all
possible combinations of a set of numbers? E.g [1,2,3] ->
[[1,2],[1,3],[2,3],[1,2,3]]. Basically I'm looking for a function that can
generate all unique pairs, triplets, quadruples, etc, etc. Any thoughts?

~ Roger



More information about the SciPy-user mailing list