Ask Your Question
1

Create group with custom set and operator

asked 2021-10-27 09:27:07 +0100

nash1212 gravatar image

Hi, I know that we can use Sage to create an instance of a predefined group like so:

H = DihedralGroup(6)

But instead of using a predefined group, can I also create a group instance having a predefined set (for example a set of natural numbers) and a custom binary operator (such as multiplication modulo N) ?

What I'm looking for is something like this:

G = new Group({1, 2, 3, 4}, (a, b) -> a * b mod 10)

And then generate the group table for G.

If someone could provide me with an code example it'd be great, I wasn't able to derive it from the docs I read.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2021-10-31 20:25:53 +0100

Max Alekseyev gravatar image

updated 2021-11-07 21:49:38 +0100

In your example you rely on multiplication of integers modulo 10, so any group using this operation will be a subgroup of the unit group of $\mathbb{Z}/10\mathbb{Z}$. However, numbers 2 and 4 cannot be there as they are not invertible modulo 10. So, perhaps you mean semigroup (monoid) rather than a group.

Semigroup $G$ for your example can be constructed as follows:

mygens = [1,2,3,4]
R = IntegerModRing(10)
G = R.subsemigroup( (R(g) for g in mygens), one=R(1) )

Then multiplication table can be constructed with OperationTable:

from sage.matrix.operation_table import OperationTable
print( OperationTable(G, operation=operator.mul, names='elements') )

which gives:

*  1 2 3 4 6 8 9 7
 +----------------
1| 1 2 3 4 6 8 9 7
2| 2 4 6 8 2 6 8 4
3| 3 6 9 2 8 4 7 1
4| 4 8 2 6 4 2 6 8
6| 6 2 8 4 6 8 4 2
8| 8 6 4 2 8 4 2 6
9| 9 8 7 6 4 2 1 3
7| 7 4 1 8 2 6 3 9

ADDED. When $G$ represents a group, we can explicitly create its isomorphic permutation group $P$ (subgroup of $\mathrm{Sym}(G)$) as in the following example:

mygens = [1,3]
R = IntegerModRing(10)
G = R.subsemigroup( (R(g) for g in mygens), one=R(1) )

P = PermutationGroup([[G(g)*b for b in G] for g in mygens], domain=G)
print("elements of P:",list(P))
M = {g:P([G(g)*b for b in G]) for g in G}  # map from G to P
print("map G->P:",M)

which prints:

elements of P: [(), (1,9)(3,7), (1,7,9,3), (1,3,9,7)]
map G->P: {1: (), 3: (1,3,9,7), 9: (1,9)(3,7), 7: (1,7,9,3)}
edit flag offensive delete link more

Comments

Thanks for your reply, but I was actually indeed talking about groups. The example was just for illustrative purposes, I don't claim that these numbers really form a group under multiplication mod 10.

Would you have an example how to create a group table for a given set and a custom binary operation?

nash1212 gravatar imagenash1212 ( 2021-11-06 16:46:30 +0100 )edit

I see two approaches here:

  • define your group as a subgroup of some universe group, where all your elements and binary operation belong (e.g., the unit group $U(\mathbb{Z}_{10})$ in case of mod 10 operation); or
  • define your group as a finitely presented group.

Your example with mod 10 suggests that you'd be better off with the first approach, but if operation is truly 'custom', the second approach may be preferable.

The third approach could be converting the semigroup defined as in my answer into a group (if it really is), but I don't know how to implement this in Sage.

Max Alekseyev gravatar imageMax Alekseyev ( 2021-11-06 17:35:07 +0100 )edit

I've added implementation of the (sort of) third approach.

Max Alekseyev gravatar imageMax Alekseyev ( 2021-11-07 21:48:36 +0100 )edit

I'm in the same as OP. Sage seems like building math in the same way making circuits from the electrodomestic store. You wan't to build a coffemaker, then if you're going to make coffee buy a coffee maker and put coffee in it. ¡But I don't know If I'm going to make coffee or tea! I'm just trying to start by soldering the heater and see what happens. All that's fun in math is being able to construct things without explicitly declaring them, but sage is no fun.

Bizarro gravatar imageBizarro ( 2023-06-22 22:17:36 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2021-10-27 09:27:07 +0100

Seen: 410 times

Last updated: Nov 07 '21