Ejemplo n.º 1
0
 def check_order_parity(self, rec, verbose=False):
     """
     check order and parity by constructing a Conrey character in Sage (use the first index in galois_orbit)
     """
     # TIME about 30000s for full table
     char = ConreyCharacter(rec['modulus'], rec['galois_orbit'][0])
     parity = 1 if char.is_even() else -1
     success = (parity == rec['parity']
                and char.conductor() == rec['conductor']
                and char.multiplicative_order() == rec['order'])
     if verbose and not success:
         print("Order-parity failure", parity, rec['parity'],
               char.conductor(), rec['conductor'],
               char.multiplicative_order(), rec['order'])
     return success
Ejemplo n.º 2
0
def get_character_modulus(a, b, limit=7):
    """ this function is also used by lfunctions/LfunctionPlot.py """
    headers = list(range(1, limit))
    headers.append("more")
    entries = {}
    rows = list(range(a, b + 1))
    for row in rows:
        if row != 1:
            G = Integers(row).list_of_elements_of_multiplicative_group()
        else:
            G = [1]
        for chi_n in G:
            chi = ConreyCharacter(row, chi_n)
            multorder = chi.multiplicative_order()
            if multorder <= limit:
                el = chi
                col = multorder
                entry = entries.get((row, col), [])
                entry.append(el)
                entries[(row, col)] = entry
    entries2 = {}
    out = lambda chi: (chi.number, chi.is_primitive(),
                       chi.multiplicative_order(), chi.is_even())
    for k, v in entries.items():
        l = []
        v = sorted(v, key=lambda x: x.number)
        while v:
            e1 = v.pop(0)
            e1_num = e1.number
            inv_num = 1 if e1_num == 1 else e1_num.inverse_mod(e1.modulus)

            inv = ConreyCharacter(e1.modulus, inv_num)

            if e1_num == inv_num:
                l.append((out(e1), ))
            else:
                l.append((out(e1), out(inv)))
                v = [
                    x for x in v
                    if (x.modulus, x.number) != (inv.modulus, inv.number)
                ]
        if k[1] == "more":
            l = sorted(l, key=lambda e: e[0][2])
        entries2[k] = l
    cols = headers
    return headers, entries2, rows, cols