Doesn't tuples
http://www.sagemath.org/doc/html/ref/module-sage.combinat.combinat.html#l2h-3041
or Tuples
http://www.sagemath.org/doc/html/ref/module-sage.combinat.tuple.html#l2h-4417
do what you want?

On Jan 24, 2008 5:13 AM, Simon King <[EMAIL PROTECTED]> wrote:
>
> 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