|
8 | 8 | import yaml |
9 | 9 | from flask import render_template |
10 | 10 |
|
11 | | -from lmfdb.utils import list_to_latex_matrix, integer_divisors, sparse_cyclotomic_to_mathml |
| 11 | +from lmfdb.utils import list_to_latex_matrix, integer_divisors, sparse_cyclotomic_to_mathml, raw_typeset, display_knowl |
12 | 12 | from lmfdb.groups.abstract.main import abstract_group_namecache, abstract_group_display_knowl |
13 | 13 | from lmfdb.groups.abstract.web_groups import WebAbstractGroup |
14 | 14 |
|
@@ -74,6 +74,16 @@ def cyclestrings(perm): |
74 | 74 | def compress_cycle_type(ct): |
75 | 75 | bits = [(str(z), f'^{{{c}}}' if c > 1 else '' ) for z, c in sorted(Counter(ct).items(),reverse=True)] |
76 | 76 | return ','.join(z + e for z,e in bits) |
| 77 | + |
| 78 | +def quick_latex(s): |
| 79 | + str = s.replace('*',' ') |
| 80 | + str = str.replace('(',r'\left(') |
| 81 | + str = str.replace(')',r'\right)') |
| 82 | + # multidigit exponents |
| 83 | + str = re.sub(r'\^\s*(\d+)', r'^{\1}',str) |
| 84 | + return '$'+str+'$' |
| 85 | + |
| 86 | + |
77 | 87 | ############ Galois group object |
78 | 88 |
|
79 | 89 |
|
@@ -248,6 +258,28 @@ def can_chartable(self): |
248 | 258 | return False |
249 | 259 | return self.wag.complex_characters_known |
250 | 260 |
|
| 261 | + @lazy_attribute |
| 262 | + def regulars(self): |
| 263 | + t = list(db.gps_regular_polynomials.search({'label':self.label})) # it will be a short list |
| 264 | + if t: |
| 265 | + genknowl = display_knowl("gg.generic_polynomial", "generic") |
| 266 | + |
| 267 | + def msg(code): |
| 268 | + if code is None: |
| 269 | + return '' |
| 270 | + if code == []: |
| 271 | + return f' is {genknowl} for any base field $K$' |
| 272 | + if code == [0]: |
| 273 | + return fr' is {genknowl} for the base field $\Q$' |
| 274 | + code = ','.join(str(z) for z in code) |
| 275 | + return fr' is {genknowl} for any base field $K$ of characteristic $\neq$ {code}' |
| 276 | + |
| 277 | + regdata= [(raw_typeset(z['polynomial'], quick_latex(z['polynomial'])), msg(z.get('generic'))) for z in t] |
| 278 | + for j, (poly, msg) in enumerate(regdata): |
| 279 | + if msg: |
| 280 | + regdata[j] = (poly, f'The polynomial $f_{{{j+1}}}$ {msg}') |
| 281 | + return regdata |
| 282 | + |
251 | 283 | def chartable(self): |
252 | 284 | self.conjclasses # called to load info in self |
253 | 285 | return render_template("character-table.html", gp=self, |
|
0 commit comments