Would you be happy with something like the following, as a unifying and easily accessible framework? Of course, I am thinking of providing also methods that convert it (back) into a representation, a combinatorial species, a permutation group.
class FiniteGroupAction(SageObject): def __init__(A, X=None, G=None): r""" A finite group action. INPUT: - ``A`` -- can be one of the following: * a permutation group, if ``X`` and ``G`` are ``None`` * a bijection on a finite set ``X``, if ``G`` is ``None`` * a map `G\times X\to X`, otherwise. - ``X`` (optional, default ``None``) -- a finite set - ``G`` (optional, default ``None``) -- a finite group EXAMPLES:: sage: G = PermutationGroup([['b','c','a']], domain=['a','b','c','d']) sage: a = GroupAction(G) sage: a.orbits() [['a', 'b', 'c'], ['d']] sage: A = lambda x: (2*x) % 6 sage: X = [0,1,2,3,4,5] sage: a = GroupAction(A, X) sage: a.orbits() [[0], [1, 2, 4], [3], [5]] sage: G = SymmetricGroup(3) sage: A = lambda g, x: g*x sage: a = GroupAction(A, G, G) sage: a.orbits() [['a', 'b', 'c', 'd']] On Monday, 2 May 2022 at 01:32:01 UTC+2 Travis Scrimshaw wrote: > Sorry, I don't know an easy way. I've always just defined them by hand >>> whenever needed. >>> However, I agree with you that a better way is needed. >>> >> >> I would love for there to be some standard way to define a group action >> on a set - preferably maintaining other algebraic properties of the set, >> such as addition! But I don't know if there is even close to a standard >> way to do this either. >> > > - There is a standard way to do this, but not a generic method/class for > it IIRC. You can do this by implementing an _act_on_() method on a wrapper > class. Yet, this requires some manual input. > - For cyclic actions, there is the DiscreteDynamicalSystem class > introduced in https://trac.sagemath.org/ticket/24128. > - There is also the Representation class in > modules/with_basis/representation.py if you want to want to extend the > action on the set to the module with a basis given by that set. > > Likely we will want to implement a class SetWithAction that automates a > collects the orbit_decomposition functions and similar together as methods > as a single global entry point. > > Best, > Travis > > > -- 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 on the web visit https://groups.google.com/d/msgid/sage-devel/20c36129-bd92-4252-9a85-a750aea7b038n%40googlegroups.com.