[sage-devel] Re: "Copy" vs "Refactor"

2022-05-02 Thread Matthias Koeppe
On Thursday, April 21, 2022 at 2:28:06 PM UTC-7 hohoa...@gmail.com wrote:

> 1/- Why "Copy" was used instead of "Refactor"? There 
> are of course good reasons for this, it is believed.
> 2/- What "deserves to be factored out at some point in the future"? The 
> "resolvelinks" function or the scripts, "sage/src/bin/sage-env", 
> "sage/sage" and "sage/src/bin/sage"? 
> 3/- When will that "point in the future" come? If "the future" is now, how 
> can these be best done? or just "que serĂ¡, serĂ¡"
>

I've updated the comment in the top-level "sage" script that led to these 
questions as part of https://trac.sagemath.org/ticket/33786 (needs review).

-- 
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/09641da6-f27b-4d64-9913-087a0458d5ecn%40googlegroups.com.


Re: [sage-devel] orbit decompositions

2022-05-02 Thread David Joyner
On Mon, May 2, 2022 at 11:24 AM 'Martin R' via sage-devel
 wrote:
>
> I am actually not sure anymore, which methods or functionality this class 
> should provide.
>
> Would it possibly be better to enhance PermutationGroup with an additional 
> optional "from_action" and "from_cyclic_action" argument?  Eg.:
>
> PermutationGroup(domain = X, cyclic_action = lambda x: f(x))
>
> PermutationGroup(domain = X, group_action = (G, lambda g, x: f(g, x)))
>

I like this idea!

> Martin
> On Monday, 2 May 2022 at 14:20:57 UTC+2 kcrisman wrote:
>>
>> On Sunday, May 1, 2022 at 7:32:01 PM UTC-4 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.
>>>
>>
>> Hmm, maybe a tutorial is needed for this.  I would imagine that a lot of 
>> people who aren't familiar with how to create a new wrapper class would be 
>> the ones who need this.   Of course, the FiniteGroupAction suggestion sounds 
>> quite welcome, too, though really having both options would be best.
>
> --
> 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/694a16d8-b59d-43bc-8b68-033c704284abn%40googlegroups.com.

-- 
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/CAEQuuAXOneCvUQ70XxfbMb4Jstek9OB-sfNpcVsgkNDXf6cdFg%40mail.gmail.com.


Re: [sage-devel] orbit decompositions

2022-05-02 Thread 'Martin R' via sage-devel
I am actually not sure anymore, which methods or functionality this class 
should provide.

Would it possibly be better to enhance PermutationGroup with an additional 
optional "from_action" and "from_cyclic_action" argument?  Eg.:

PermutationGroup(domain = X, cyclic_action = lambda x: f(x))

PermutationGroup(domain = X, group_action = (G, lambda g, x: f(g, x)))

Martin
On Monday, 2 May 2022 at 14:20:57 UTC+2 kcrisman wrote:

> On Sunday, May 1, 2022 at 7:32:01 PM UTC-4 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.
>>
>>
> Hmm, maybe a tutorial is needed for this.  I would imagine that a lot of 
> people who aren't familiar with how to create a new wrapper class would be 
> the ones who need this.   Of course, the FiniteGroupAction suggestion 
> sounds quite welcome, too, though really having both options would be best.
>

-- 
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/694a16d8-b59d-43bc-8b68-033c704284abn%40googlegroups.com.


Re: [sage-devel] orbit decompositions

2022-05-02 Thread kcrisman


On Sunday, May 1, 2022 at 7:32:01 PM UTC-4 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.
>
>
Hmm, maybe a tutorial is needed for this.  I would imagine that a lot of 
people who aren't familiar with how to create a new wrapper class would be 
the ones who need this.   Of course, the FiniteGroupAction suggestion 
sounds quite welcome, too, though really having both options would be best.

-- 
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/5300f5bd-7e75-41d5-980d-cf207ce2e40fn%40googlegroups.com.


Re: [sage-devel] orbit decompositions

2022-05-02 Thread David Joyner
1) This is okay with me, but by "set" I assume you don't mean "Set":-)
For example,
sage: A = lambda g, x: g*x
sage: G = SL(2,5)
sage: X = GF(5)^2
sage: a = GroupAction(A, X, G)
sage: a.orbits()
should return something reasonable.
2) Your new class should be consistent with the built in action
of permutation groups and automorphism groups on various
objects (eg, graphs, block designs, incidence structures)
It would be nice if there could be a default "A" in this
case.

Some examples of such built-in orbits,
sage: A = lambda g, x: g*x
sage: X = [1,2,3,4]
sage: G = SymmetricGroup(X)
sage: H = G.subgroup([[(1,2),(3,4)]]);
sage: a = GroupAction(A, H, X)
sage: a.orbits()
should be consistent with the built in permutation group action
sage: X = [1,2,3,4]
sage: G = SymmetricGroup(X)
sage: H = G.subgroup([[(1,2),(3,4)]]); H.list()
[(), (1,2)(3,4)]
sage: H.orbits()
[[1, 2], [3, 4]]
and
sage: A = lambda g, x: g*x
sage: X = graphs.ButterflyGraph()
sage: G = Gamma.automorphism_group()
sage: a = GroupAction(A, G, Gamma)
sage: a.orbits()
should give more or less the same output as
sage: Gamma = graphs.ButterflyGraph()
sage: G = Gamma.automorphism_group()
sage: G.orbits()
[[0, 1, 2, 3], [4]]
However, I'm not sure how your class would yield the output of
sage: P = designs.DesarguesianProjectivePlaneDesign(2)
sage: G = P.automorphism_group()
sage: G.orbits()
[[(0, 0, 1), (1, 0, 1), (0, 1, 1), (1, 0, 0), (1, 1, 1), (0, 1, 0), (1, 1, 0)]]



On Mon, May 2, 2022 at 4:39 AM 'Martin R' via sage-devel
 wrote:
>
> 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.

-- 
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/CAEQuuAU48K0n162dR8P32n%2Bie7xHS2ph2ETpZLzB7SNd9Bnzbw%40mail.gmail.com.


Re: [sage-devel] orbit decompositions

2022-05-02 Thread 'Martin R' via sage-devel
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.