Are you sure that you need Tuple() at all for what you are doing?  Try
looking at the documentaion for it with Tuples?  If all you want to do
is count the number of times an element appears in a list, use the
count() function which every lisy has, like this

sage: u=[1+I,1+I,1+I,2+I,2+I,2+I,2+I]
sage: u.count(1+I)
3
sage: u.count(2+I)
4

John Cremona

2008/5/9 Rose <[EMAIL PROTECTED]>:
>
> Hi,
>
> (I am a Newbie)
> I need to count complex number in Tuples and the only way I found out
> is to use Tuples(l,1).count() or UnorderedTuples(l,1).count() (I don't
> understand the difference), but I have two problems.
>
> First, it counts only once an element that is twice in my Tuples.
>       ex: sage: u=[1,2,1]
>             sage:  Tuples(u,1).count()
>             2
>
> Second, it becomes pretty long went there are complex numbers in my
> Tuples (more than 30 secondes for 7 elements).
>
> I would like to know if there is a better way to count a Tuples of
> complex number.
>
> In general, it is really long when I utilize Tuples with complex
> number (in comparaison of doing 2 Tuples, one for real part and one
> for imaginary part).
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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