Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action of a sympy TensorSymmetry #32029

Open
mkoeppe opened this issue Jun 22, 2021 · 14 comments
Open

Action of a sympy TensorSymmetry #32029

mkoeppe opened this issue Jun 22, 2021 · 14 comments

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Jun 22, 2021

SymPy's TensorSymmetry (https://docs.sympy.org/latest/modules/tensor/tensor.html) uses a trick to represent (monoterm) tensor symmetries and antisymmetries as permutation groups: Two extra elements (in the example below, 3 and 4) keep track of the sign

sage: TensorSymmetry.fully_symmetric(3)                                                                                               
TensorSymmetry((0, 1), ((4)(0 1), (4)(1 2)))
sage: TensorSymmetry.fully_symmetric(-3)    # fully antisymmetric 3 indices                                                                                      
TensorSymmetry((0, 1), ((0 1)(3 4), (1 2)(3 4)))

The 2-cycle (3 4) represents the antisymmetry. What is displayed there is the "base and strong generating system".

This trick can of course be generalized to Mathematica's "phased permutation groups" (#30276) by using longer cycles.

We define a class TensorSymmetryGroup

  • which can be initialized from sage.tensor sym and antisym lists
  • can convert to/from sympy.tensor.tensor.TensorSymmetry
  • defines _get_action_ for acting on tensor modules / components

CC: @tscrim @egourgoulhon @dimpase @honglizhaobob @spaghettisalat

Component: linear algebra

Branch/Commit: u/mkoeppe/action_of_a_sympy_tensorsymmetry @ 3629386

Issue created by migration from https://trac.sagemath.org/ticket/32029

@mkoeppe mkoeppe added this to the sage-9.4 milestone Jun 22, 2021
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 22, 2021

comment:3

I'm thinking of putting this in sage.groups.tensor.monoterm_symmetry

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 22, 2021

@dimpase
Copy link
Member

dimpase commented Jun 22, 2021

Commit: ad4f3f1

@dimpase
Copy link
Member

dimpase commented Jun 22, 2021

comment:5

the symmetry group there is an arbitrary permutation group, no? So sympy has an algorithm to find the autmorphism group of a weighted hypergraph?


New commits:

ad4f3f1src/sage/groups/tensor/monoterm_symmetry.py: New

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 22, 2021

comment:6

Replying to @dimpase:

the symmetry group there is an arbitrary permutation group, no? So sympy has an algorithm to find the autmorphism group of a weighted hypergraph?

The automorphism group is the input, not the output. This code is for defining spaces of tensors with prescribed symmetries.

@dimpase
Copy link
Member

dimpase commented Jun 22, 2021

comment:7

Your input is a bunch of permutations, not a group. Why do you force the user to figure them out?

I'd rather see it as a group, and yes, it's perfectly possible in Sage to compute a strong generating set and a base, given a permutation group.
E.g. one can use the corresponding GAP functionality via libgap.

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 22, 2021

comment:8

Replying to @dimpase:

Your input is a bunch of permutations, not a group. Why do you force the user to figure them out?

Sorry, what are you referring to?

The example lines on the ticket description using SymPy show the output of SymPy's TensorSymmetry constructor, which happens to show the BSGS.

In the branch attached here, the input is a symmetry specification in the style of sage.tensor.

@dimpase
Copy link
Member

dimpase commented Jun 22, 2021

comment:9

All I can see is an example with sym=(1, 2) - it's totally unclear what kind of input is expected, due to lack of any documentation.

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 22, 2021

comment:10

OK. I will adapt documentation from sage.tensor.modules.comp, where this input is documented.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 22, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

3629386TensorSymmetryGroup: Adapt some documentation from sage.tensor.modules.comp

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 22, 2021

Changed commit from ad4f3f1 to 3629386

@dimpase
Copy link
Member

dimpase commented Jun 22, 2021

comment:12
+        * ``sym = [(0,2), (1,3,4)]`` for a symmetry between the 1st and 3rd
+          indices and a symmetry between the 2nd, 4th and 5th indices.

is ambiguous. E.g. sym = [(0,2), (1,3)] might either mean one order 2 symmetry (i.e. group of symmetries of order 2), or
a list of generators for a group of order 4.
In the former can one should say something like ``a symmetry which acts as a permutation (13)(24). In the latter, say they generate a group...

@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 14, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Mar 5, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Aug 31, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.8, sage-9.9 Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants