Am Freitag, 19. Juni 2020 18:40:34 UTC+2 schrieb Nils Bruin:
>
> All this disappears once we are happy using functions with two parameters 
> as "action operation":
>
> left = G.acting_on_the_left_on(M) # or left = M.left_action_by(G)
>
> left(g,m)
>
> left = G.acting_on_the_right_on(M) # or left = M.right_action_by(G)
>
> right(m,g)
>

This functionality is already available for actions that are actually 
implemented via Action:

sage: G = SymmetricGroup(3)
sage: M = MatrixSpace(QQ, 3)
sage: right = coercion_model.get_action(M, G)
sage: right(M.diagonal_matrix([1,2,3]), G('(2,3)'))  # with #29808
⎛1 0 0⎞
⎜0 0 2⎟
⎝0 3 0⎠

For cases where this is not implemented, it is possible to construct and 
register custom actions (a factory function for this might be useful). For 
example, the right action of the symmetric group on the integers via 
exponentiation:

sage: class CallAction(sage.categories.action.Action):
....:     def _act_(self, g, a):
....:         return g(a)
sage: G = SymmetricGroup(3); g, h = G('(1,2,3)'), G('(2,3)')
sage: right = CallAction(G, ZZ, is_left=False, op=operator.pow)
sage: right(right(1, g), h)
3
sage: ZZ._unset_coercions_used()
sage: ZZ.register_action(right)
sage: (1 ^ g) ^ h
3
sage: 1 ^ (g * h)
3

It is not currently possible to use shift operators for this, as they are 
not implemented in sage.structure.element. Also, it might not be easily 
possible to support the operator syntax for actions on non-Sage types such 
as Python lists.
 

-- 
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/219e0c77-210f-4cbb-89dc-71493ffb28e7o%40googlegroups.com.

Reply via email to