Dear Sage team,

how can i compute the n-fold Cartesian product of of a list?

My hope was that the following works
sage: P=CartesianProduct([1,2], 3)
sage: P.list()

[[1, 1, 1],
 [1, 1, 2],
 [1, 2, 1],
 [1, 2, 2],
 [2, 1, 1],
 [2, 1, 2],
 [2, 2, 1],
 [2, 2, 2]]

but this is not supported.

I find it inconvenient to explicitly plug n copies of [1,2] into
CartesianProduct, in particular if i don't know the value of n in
advance (say, if i use it inside a function that has n as an
argument).

I guess there is a standard function solving my problem, but i
couldn't find it.
Yours
     Simon

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to