diff --git a/lib/properties.gd b/lib/properties.gd index 50b3f4d..e7023d3 100644 --- a/lib/properties.gd +++ b/lib/properties.gd @@ -230,6 +230,19 @@ DeclareAttribute("LeftOrder", IsExtLElement); #! returns a right order of element m. DeclareAttribute("RightOrder", IsExtRElement); +#! @Arguments [m] +#! @Description +#! returns a list [i, p] of minimum numbers such that +#! LeftPower(m, i + p) = LeftPower(m, i); computed via transposition +#! and right-hand index-period on the transposed magma. +DeclareAttribute("LeftIndexPeriod", IsExtLElement); + +#! @Arguments [m] +#! @Description +#! returns a list [i, p] of minimum numbers such that +#! RightPower(m, i + p) = RightPower(m, i). +DeclareAttribute("RightIndexPeriod", IsExtRElement); + #! @Arguments [m] #! @Description #! returns a left order of element m. diff --git a/lib/properties.gi b/lib/properties.gi index 39b6115..2ae96af 100644 --- a/lib/properties.gi +++ b/lib/properties.gi @@ -204,6 +204,40 @@ InstallMethod(RightOrder, "for a right-multiplicable element", [IsExtRElement], return infinity; end); +InstallMethod(LeftIndexPeriod, "for a left-multiplicable element", [IsExtLElement], + function(m) + local M, MT, pos; + M := Parent(m); + MT := TransposedMagma(M); + pos := Position(Elements(M), m); + if pos = fail then + Error("LeftIndexPeriod: element ", m, " not found in parent magma"); + fi; + return RightIndexPeriod(Elements(MT)[pos]); +end); + +InstallMethod(RightIndexPeriod, "for a right-multiplicable element", [IsExtRElement], + function(m) + local index, maxExponent, n, powerExponent, powers, y; + n := Size(Parent(m)); + if n = 1 then + return [1, 1]; + fi; + maxExponent := n ^ 2; + y := m; + powers := []; + + for powerExponent in [1 .. maxExponent] do + index := Position(powers, y); + if index <> fail then + return [index, powerExponent - index]; + fi; + Add(powers, y); + y := y * m; + od; + Error("RightIndexPeriod: no index-period found up to n^2 for element ", m, " in magma of size ", n); +end); + InstallMethod(LeftOrdersOfElements, "for a magma", [IsMagma], function(M) return Collected(List(M, m -> LeftOrder(m))); @@ -285,4 +319,4 @@ end); InstallMethod(DigraphOfDiagonal, "for a magma", [IsMagma], function(M) return DigraphByEdges(List([1 .. Size(M)], m -> [m, DiagonalOfMultiplicationTable(M)[m]])); -end); \ No newline at end of file +end); diff --git a/tst/test_properties_element_left_right_index_period.tst b/tst/test_properties_element_left_right_index_period.tst new file mode 100644 index 0000000..15c1c3f --- /dev/null +++ b/tst/test_properties_element_left_right_index_period.tst @@ -0,0 +1,65 @@ +gap> START_TEST("test_properties_element_left_right_index_period.tst"); + +gap> BruteRightIndexPeriod := function(m) +> local i, n, p; +> n := Size(Parent(m)); +> for i in [1 .. n ^ 2] do +> for p in [1 .. n ^ 2] do +> if RightPower(m, i + p) = RightPower(m, i) then +> return [i, p]; +> fi; +> od; +> od; +> end; +function( m ) ... end + +gap> BruteLeftIndexPeriod := function(m) +> local M, T, em, pos; +> M := Parent(m); +> T := TransposedMagma(M); +> em := Elements(M); +> pos := Position(em, m); +> return BruteRightIndexPeriod(Elements(T)[pos]); +> end; +function( m ) ... end + +gap> ForAll(AllSmallGroups([1 .. 10]), G -> ForAll(Elements(G), g -> LeftIndexPeriod(g) = [1, Order(g)])); +true + +gap> ForAll(AllSmallGroups([1 .. 10]), G -> ForAll(Elements(G), g -> RightIndexPeriod(g) = [1, Order(g)])); +true + +gap> G := SmallGroup(1, 1);; +gap> LeftIndexPeriod(One(G)); +[ 1, 1 ] +gap> RightIndexPeriod(One(G)); +[ 1, 1 ] + +gap> ForAll(AllSmallGroups([1 .. 10]), G -> ForAll(Elements(G), g -> LeftIndexPeriod(g) = BruteLeftIndexPeriod(g))); +true + +gap> ForAll(AllSmallGroups([1 .. 10]), function(G) +> local T, eg, et; +> T := TransposedMagma(G); +> eg := Elements(G); +> et := Elements(T); +> return ForAll([1 .. Length(eg)], i -> LeftIndexPeriod(eg[i]) = RightIndexPeriod(et[i])); +> end); +true + +gap> ForAll(AllSmallAntimagmas([2 .. 3]), function(M) +> local T, em, et; +> T := TransposedMagma(M); +> em := Elements(M); +> et := Elements(T); +> return ForAll([1 .. Length(em)], i -> LeftIndexPeriod(em[i]) = RightIndexPeriod(et[i])); +> end); +true + +gap> ForAll(AllSmallAntimagmas([2 .. 3]), M -> ForAll(Elements(M), m -> RightIndexPeriod(m) = BruteRightIndexPeriod(m))); +true + +gap> ForAny(AllSmallAntimagmas([2 .. 3]), M -> ForAny(Elements(M), m -> LeftIndexPeriod(m) <> RightIndexPeriod(m))); +true + +gap> STOP_TEST("test_properties_element_left_right_index_period.tst");