Ejemplo n.º 1
0
def classical_groups(m):
    """Returns list of classical groups, such that \pi(G) is contained in the
     set of first m primes.
    """
    ret = []
    primes = first_primes(m)
    set_primes = set(primes)
    for p in primes:
        for n in range(1, m + 2):
            t = _min_power(p, n, primes)
            for alpha in range(1, t + 1):
                field = Field(p, alpha)
                to_check = []
                if n >= 2 and (n, field.order) not in [(2, 2), (2, 3)]:
                    to_check.append(ClassicalGroup("PSL", n, field))
                if (n, field.order) != (1, 2):
                    if n > 1:
                        to_check.append(ClassicalGroup("PSU", 2 * n, field))
                    to_check.append(ClassicalGroup("PSU", 2 * n + 1, field))
                if n >= 2 and field.char % 2 == 1:
                    to_check.append(ClassicalGroup("Omega", 2 * n + 1, field))
                if n >= 3:
                    to_check.append(
                        ClassicalGroup("POmega+", 2 * (n + 1), field))
                    to_check.append(
                        ClassicalGroup("POmega-", 2 * (n + 1), field))
                if n >= 2:
                    to_check.append(ClassicalGroup("PSp", 2 * n, field))

                valid = lambda group: _prime_factors(group.order()
                                                     ) <= set_primes
                ret.extend(filter(valid, to_check))
    ret.sort(
        key=lambda group: (max(group.order().factors.keys()), group.order()))
    return ret
Ejemplo n.º 2
0
def print_max_elems():
    for dimension in xrange(4, 36):
        group = ClassicalGroup("Omega+", 2 * dimension, 4)
        dim_expansion = " + ".join(
            [str(x) for x in numeric.binary_expansion(dimension)])
        print "{}:".format(group).ljust(12),
        print "n = {} = {}".format(dimension, dim_expansion).ljust(30)
        print
        for elem in max_orders_wrapped(group, StringViewFormatter.VERBOSE):
            print str(elem).ljust(len(str(elem)) + 5).rjust(60), sorted(
                elem.object.partition, reverse=True)
        print
Ejemplo n.º 3
0
 def selected_group(self):
     """Returns currently selected group
     """
     if self._group_type.get() == "Alternating":
         self._alt_degree.refresh_input()
         return AlternatingGroup(self._alt_degree.get_number())
     if self._group_type.get() == "Classical":
         self._clas_dim.refresh_input()
         self._clas_field.refresh_input()
         return ClassicalGroup(self._clas_type.variable.get(),
                               self._clas_dim.get_number(), self._clas_field.get_number())
     if self._group_type.get() == "Sporadic":
         return SporadicGroup(self._sporadic_group.variable.get())
     if self._group_type.get() == "Exceptional":
         self._ex_field.refresh_input()
         return ExceptionalGroup(self._ex_type.variable.get(), self._ex_field.get_number())
Ejemplo n.º 4
0
 def test_classical_orders(self, params):
     g = ClassicalGroup(*params)
     order = orders_data.classical_orders_data[params]
     self.assertEqual(order, g.order())
Ejemplo n.º 5
0
 def test_symplectic(self, n):
     group = ClassicalGroup("Sp", 2 * n, 2)
     max_elems = max_orders.maximal_orders(group)
     max_elems_2 = maximal_orders(group, 2)
     self.assertEqual(max_elems[0], max_elems_2[0])
     self.assertEqual(max_elems[1], max_elems_2[1])
Ejemplo n.º 6
0
    def _init_components(self):
        # group type selection (alternating, classical, sporadic, exceptional)
        group_type_frame = LabelFrame(self, text="Group type", padx=10, pady=5)
        group_type_frame.pack(expand=True, fill='x')

        # group type radio buttons (Alternating, Classical etc.)
        self._group_type = StringVar()
        self._type_radio_buttons = dict()
        for group_type in ("Alternating", "Classical", "Exceptional", "Sporadic"):
            radiobutton = Radiobutton(group_type_frame, variable=self._group_type, value=group_type, text=group_type)
            radiobutton.pack(anchor='nw')
            self._type_radio_buttons[group_type] = radiobutton

        # set group type selection handler
        self._group_type.trace("w", lambda n, i, m: self._group_type_selection())

        # spacer
        Frame(self, height=10).pack()

        # parameters for each group (degree for alternating, field and dimension for classical etc.)
        # notice that we do not pack LabelFrame contents. We do that in _group_type_selection method instead.
        group_params_frame = LabelFrame(self, text="Parameters", padx=10, pady=5)
        group_params_frame.pack(expand=True, fill='x')

        # alternating
        self._alt_params = Frame(group_params_frame)
        self._alt_params.columnconfigure(1, weight=1)
        Label(self._alt_params, text="Degree").grid(sticky='w')
        self._alt_degree = NumberBox(self._alt_params, constraints=Constraints(min=5))
        self._alt_degree.grid(row=0, column=1, sticky='we')

        # classical
        self._clas_params = Frame(group_params_frame)
        self._clas_params.columnconfigure(1, weight=1)

        Label(self._clas_params, text="Type").grid(row=0, sticky='w')
        self._clas_type = OptionList(self._clas_params, values=ClassicalGroup.types())
        self._clas_type.variable.trace("w", lambda n, i, m: self._classical_group_type_selection())
        self._clas_type.grid(row=0, column=1, sticky='we')

        Label(self._clas_params, text="Dimension").grid(row=1, sticky='w')
        self._clas_dim = NumberBox(self._clas_params)
        self._clas_dim.grid(row=1, column=1, sticky='we')

        Label(self._clas_params, text="Field order").grid(row=2, sticky='w')
        self._clas_field = NumberBox(self._clas_params, constraints=Constraints(primality=numeric.PRIME_POWER))
        self._clas_field.grid(row=2, column=1, sticky='we')

        self._classical_group_type_selection()

        # exceptional
        self._ex_params = Frame(group_params_frame)
        self._ex_params.columnconfigure(1, weight=1)

        Label(self._ex_params, text="Type").grid(row=0, sticky='w')
        self._ex_type = OptionList(self._ex_params, values=ExceptionalGroup.types())
        self._ex_type.setvar(value=ExceptionalGroup.types()[0])
        self._ex_type.variable.trace("w", lambda n, i, m: self._exceptional_group_type_selection())
        self._ex_type.grid(row=0, column=1, sticky='we')

        Label(self._ex_params, text="Field order").grid(row=1, sticky='w')
        self._ex_field = NumberBox(self._ex_params, constraints=Constraints(primality=numeric.PRIME_POWER))
        self._ex_field.grid(row=1, column=1, sticky='we')
        self._exceptional_group_type_selection()

        # sporadic
        self._spor_params = Frame(group_params_frame)
        self._spor_params.columnconfigure(1, weight=1)

        Label(self._spor_params, text="Group").grid(row=0, sticky='w')
        self._sporadic_group = OptionList(self._spor_params, values=SporadicGroup.all_groups())
        self._sporadic_group.grid(row=0, column=1, sticky='we')
Ejemplo n.º 7
0
 def _classical_group_type_selection(self):
     name = self._clas_type.variable.get()
     self._clas_dim.set_constraints(ClassicalGroup.dim_constraints(name))
     self._clas_field.set_constraints(ClassicalGroup.field_constraints(name))
Ejemplo n.º 8
0
 def test_classical_orders(self, params):
     g = ClassicalGroup(*params)
     order = orders_data.classical_orders_data[params]
     self.assertEqual(order, g.order())
Ejemplo n.º 9
0
 def test_classical_str(self):
     g = ClassicalGroup("PSp", 4, Field(2, 3))
     self.assertEqual("PSp(4, 8)", str(g))
Ejemplo n.º 10
0
 def test_classical_field(self):
     for g in (ClassicalGroup("PSp", 4, Field(2, 3)),
               ClassicalGroup("PSp", 4, 2, 3),
               ClassicalGroup("PSp", 4, 8)):
         self.assertEqual(2, g.field.char)
         self.assertEqual(3, g.field.pow)
Ejemplo n.º 11
0
 def test_classical_spectra(self, params):
     g = ClassicalGroup(*params)
     apex = spectra_data.classical[params]
     self.assertSetEqual(set(apex), set(g.apex()))
Ejemplo n.º 12
0
    def _init_components(self):
        # group type selection (alternating, classical, sporadic, exceptional)
        group_type_frame = LabelFrame(self, text="Group type")
        group_type_frame.pack(expand=True, fill="x", padx=10, pady=5)

        # group type radio buttons (Alternating, Classical etc.)
        self._group_type = StringVar()
        self._type_radio_buttons = dict()
        for type in ("Alternating", "Classical", "Exceptional", "Sporadic"):
            self._type_radio_buttons[type] = Radiobutton(
                group_type_frame, variable=self._group_type, value=type, text=type
            )
            self._type_radio_buttons[type].pack(anchor="nw", padx=10)

        # set group type selection handler
        self._group_type.trace("w", lambda n, i, m: self._group_type_selection())

        # parameters for each group (degree for alternating, field and
        # dimension for classical etc.
        group_params_frame = LabelFrame(self, text="Parameters")
        group_params_frame.pack(expand=True, fill="x", padx=10, pady=5)

        # alternating
        self._alt_params = Frame(group_params_frame)
        self._alt_params.columnconfigure(1, weight=1)
        Label(self._alt_params, text="Degree").grid(sticky="w")
        self._alt_degree = NumberBox(self._alt_params, constraints=Constraints(min=5))
        self._alt_degree.grid(row=0, column=1, sticky="we")

        # classical
        self._clas_params = Frame(group_params_frame)
        self._clas_params.columnconfigure(1, weight=1)
        Label(self._clas_params, text="Type").grid(row=0, sticky="w")
        self._clas_type = OptionList(self._clas_params, values=ClassicalGroup.types())

        self._clas_type.variable.trace("w", lambda n, i, m: self._classical_group_type_selection())

        self._clas_type.grid(row=0, column=1, sticky="we")

        Label(self._clas_params, text="Dimension").grid(row=1, sticky="w")
        self._clas_dim = NumberBox(self._clas_params)
        self._clas_dim.grid(row=1, column=1, sticky="we")
        Label(self._clas_params, text="Field order").grid(row=2, sticky="w")
        self._clas_field = NumberBox(self._clas_params, constraints=Constraints(primality=numeric.PRIME_POWER))
        self._clas_field.grid(row=2, column=1, sticky="we")

        self._classical_group_type_selection()

        # exceptional
        self._ex_params = Frame(group_params_frame)
        self._ex_params.columnconfigure(1, weight=1)
        Label(self._ex_params, text="Type").grid(row=0, sticky="w")
        self._ex_type = OptionList(self._ex_params, values=ExceptionalGroup.types())
        self._ex_type.setvar(value=ExceptionalGroup.types()[0])
        self._ex_type.grid(row=0, column=1, sticky="we")
        Label(self._ex_params, text="Field order").grid(row=1, sticky="w")
        self._ex_field = NumberBox(self._ex_params, constraints=Constraints(primality=numeric.PRIME_POWER))
        self._ex_field.grid(row=1, column=1, sticky="we")

        # sporadic
        self._spor_params = Frame(group_params_frame)
        self._spor_params.columnconfigure(1, weight=1)
        Label(self._spor_params, text="Group").grid(row=0, sticky="w")
        self._sporadic_group = OptionList(self._spor_params, values=SporadicGroup.all_groups())
        self._sporadic_group.grid(row=0, column=1, sticky="we")

        # pack params frames
        for child_frame in group_params_frame.winfo_children():
            child_frame.pack(expand=True, fill="x", padx=10)
Ejemplo n.º 13
0
 def _classical_group_type_selection(self):
     name = self._clas_type.variable.get()
     self._clas_dim.set_constraints(ClassicalGroup.dim_constraints(name))
     self._clas_field.set_constraints(ClassicalGroup.field_constraints(name))
Ejemplo n.º 14
0
 def test_apex_nums_are_integers(self, params):
     g = ClassicalGroup(*params)
     self.assertTrue(all(isinstance(i, int) for i in g.apex()), g.apex())
Ejemplo n.º 15
0
    def _init_components(self):
        # group type selection (alternating, classical, sporadic, exceptional)
        group_type_frame = LabelFrame(self, text="Group type", padx=10, pady=5)
        group_type_frame.pack(expand=True, fill='x')

        # group type radio buttons (Alternating, Classical etc.)
        self._group_type = StringVar()
        self._type_radio_buttons = dict()
        for group_type in ("Alternating", "Classical", "Exceptional", "Sporadic"):
            radiobutton = Radiobutton(group_type_frame, variable=self._group_type, value=group_type, text=group_type)
            radiobutton.pack(anchor='nw')
            self._type_radio_buttons[group_type] = radiobutton

        # set group type selection handler
        self._group_type.trace("w", lambda n, i, m: self._group_type_selection())

        # spacer
        Frame(self, height=10).pack()

        # parameters for each group (degree for alternating, field and dimension for classical etc.)
        # notice that we do not pack LabelFrame contents. We do that in _group_type_selection method instead.
        group_params_frame = LabelFrame(self, text="Parameters", padx=10, pady=5)
        group_params_frame.pack(expand=True, fill='x')

        # alternating
        self._alt_params = Frame(group_params_frame)
        self._alt_params.columnconfigure(1, weight=1)
        Label(self._alt_params, text="Degree").grid(sticky='w')
        self._alt_degree = NumberBox(self._alt_params, constraints=Constraints(min=5))
        self._alt_degree.grid(row=0, column=1, sticky='we')

        # classical
        self._clas_params = Frame(group_params_frame)
        self._clas_params.columnconfigure(1, weight=1)

        Label(self._clas_params, text="Type").grid(row=0, sticky='w')
        self._clas_type = OptionList(self._clas_params, values=ClassicalGroup.types())
        self._clas_type.variable.trace("w", lambda n, i, m: self._classical_group_type_selection())
        self._clas_type.grid(row=0, column=1, sticky='we')

        Label(self._clas_params, text="Dimension").grid(row=1, sticky='w')
        self._clas_dim = NumberBox(self._clas_params)
        self._clas_dim.grid(row=1, column=1, sticky='we')

        Label(self._clas_params, text="Field order").grid(row=2, sticky='w')
        self._clas_field = NumberBox(self._clas_params, constraints=Constraints(primality=numeric.PRIME_POWER))
        self._clas_field.grid(row=2, column=1, sticky='we')

        self._classical_group_type_selection()

        # exceptional
        self._ex_params = Frame(group_params_frame)
        self._ex_params.columnconfigure(1, weight=1)

        Label(self._ex_params, text="Type").grid(row=0, sticky='w')
        self._ex_type = OptionList(self._ex_params, values=ExceptionalGroup.types())
        self._ex_type.setvar(value=ExceptionalGroup.types()[0])
        self._ex_type.grid(row=0, column=1, sticky='we')

        Label(self._ex_params, text="Field order").grid(row=1, sticky='w')
        self._ex_field = NumberBox(self._ex_params, constraints=Constraints(primality=numeric.PRIME_POWER))
        self._ex_field.grid(row=1, column=1, sticky='we')

        # sporadic
        self._spor_params = Frame(group_params_frame)
        self._spor_params.columnconfigure(1, weight=1)

        Label(self._spor_params, text="Group").grid(row=0, sticky='w')
        self._sporadic_group = OptionList(self._spor_params, values=SporadicGroup.all_groups())
        self._sporadic_group.grid(row=0, column=1, sticky='we')