From: Michael Orlitzky Date: Fri, 10 Apr 2026 11:48:39 +0000 (-0400) Subject: mjo/clan/clan.py: new method _test_left_symmetry() X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=6887cbe3434d58f386e58db7527c4852ec5f8242;p=sage.d.git mjo/clan/clan.py: new method _test_left_symmetry() The first of three tests for the clan axioms. --- diff --git a/mjo/clan/clan.py b/mjo/clan/clan.py index 56ada41..bff8684 100644 --- a/mjo/clan/clan.py +++ b/mjo/clan/clan.py @@ -121,3 +121,34 @@ class Clan(CombinatorialFreeModule): """ return self._mt[i][j] + + def _test_left_symmetry(self): + r""" + Check the left-symmetry axiom of this clan. + + SETUP:: + + sage: from mjo.clan.random import random_clan + + EXAMPLES:: + + sage: C = random_clan() # long time + sage: C._test_left_symmetry() # long time + True + + """ + def check(x,y): + actual = x.leftreg()*y.leftreg() - y.leftreg()*x.leftreg() + expected = (x*y - y*x).leftreg() + return (actual == expected) + + # Check the basis... + b = self.basis() + result = all( check(b[i], b[j]) for j in b.keys() for i in b.keys() ) + + # And some random elements for good measure + xs = ( self.random_element() for _ in range(10) ) + ys = ( self.random_element() for _ in range(10) ) + result |= all( check(x, y) for x in xs for y in ys ) + + return result