On Wednesday, 20 August 2025 at 02:57:36 UTC-7 axio...@yahoo.de wrote:

Well, rank is really the standard term in computational combinatorics.


But, as you note, it doesn't play nicely with terminology from other areas 
of mathematics -- the meaning of "rank" as for a matrix and for (free) rank 
of a module is very ingrained. Due to its very standard meaning for matrix, 
I'm confident that scoring the use of "rank" in the math literature will 
associate it most with its module meaning. For elliptic curves, this 
meaning also comes up for the abelian group formed by their rational points 
(a Z-module).

A common tool used to resolve such name clashes is to use an underscored 
name. So you'd end up with ordinal_rank or enumeration_rank then. I still 
like enumeration_index better in that context.

For "unrank" you could use enumeration_object or enumeration_element then, 
although I'm not too charmed by those.
 

  It seems to me that index is already quite overloaded: for example, 
`CombinatorialObject` defines it. I cannot find `index` as an alias for 
`rank`, where did you see that?


sage: V=EnumeratedSets()([1..10])
sage: V.index
<bound method FiniteEnumeratedSet.rank of {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}>
sage: V.rank
<bound method FiniteEnumeratedSet.rank of {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}>

The docstring actually refers to "index" and makes no mention of "rank".

In src/sage/sets/finite_enumerated_set.py we have:

    def rank(self, x):
        """
        Return the index of ``x`` in this finite enumerated set.

        EXAMPLES::

            sage: S = FiniteEnumeratedSet(['a','b','c'])
            sage: S.index('b')
            1
        """
        return self._elements.index(x)

    index = rank

 

I think that the main use for rank and unrank is to have an arbitrary, but 
deterministic total order on the elements, and to be able to create 
elements at random.  So, I would say they are of "technical" use, as 
opposed to "mathematical" use, apologies for my vague language.  Therefore, 
I'd prefer a method name that makes this clear.


Well, it says it's an enumerated set. I would say such a set comes with a 
bijection from [0..n]. Otherwise it's just a countable (or finite) set. In 
fact, I would expect that in the category of enumerated sets an isomorphism 
would respect that bijection too, so permutations would NOT be 
automorphisms in that category. We'd have enumerable sets if we do want to 
consider them automorphisms. EnumeratedSets should just be sequences 
without repeating elements. In fact if you don't insist that the ordinal 
map is an injection, it would even be allowed to have repeating elements.

I don't think data that is necessary to describe an object in a category up 
to isomorphism is not "mathematical". 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/26ea07f7-4146-4911-88a3-7ff424fceb2an%40googlegroups.com.

Reply via email to