small name cleanup
This commit is contained in:
parent
77dfe62b06
commit
ddcfc8cad7
@ -39,7 +39,7 @@ def loeschian_numbers() -> Iterator[int]:
|
||||
|
||||
GoldbergOperator: TypeAlias = Literal["c", "dk", "tk", "w", "g_T"]
|
||||
|
||||
goldberg_parameters_to_operations = {
|
||||
goldberg_parameters_to_operators = {
|
||||
# Class I
|
||||
(1, 0): "",
|
||||
(2, 0): "dud = c",
|
||||
@ -54,8 +54,8 @@ goldberg_parameters_to_operations = {
|
||||
(4, 4): "dkduud = dkcc",
|
||||
# Class III
|
||||
(2, 1): "w",
|
||||
(3, 1): "*", # loeschian(3, 1) = 13, which is prime
|
||||
(3, 2): "*", # loeschian(3, 2) = 19, which is prime
|
||||
(3, 1): "*", # loeschian(3, 1) = 13 is prime
|
||||
(3, 2): "*", # loeschian(3, 2) = 19 is prime
|
||||
(4, 1): "wdk",
|
||||
(4, 2): "wc",
|
||||
}
|
||||
@ -63,8 +63,8 @@ goldberg_parameters_to_operations = {
|
||||
# Reverse-lookup for the above table
|
||||
goldberg_operators_to_parameters = {
|
||||
operation: parameter
|
||||
for parameter in goldberg_parameters_to_operations
|
||||
for operation in goldberg_parameters_to_operations[parameter].split(" = ")
|
||||
for parameter in goldberg_parameters_to_operators
|
||||
for operation in goldberg_parameters_to_operators[parameter].split(" = ")
|
||||
if operation != "*"
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ def from_same_eigenspace(
|
||||
|
||||
|
||||
# Matrices applied over column vectors of the form [v, e, f]
|
||||
goldberg_operators: dict[GoldbergOperator, sympy.Matrix] = {
|
||||
goldberg_matrix_operators: dict[GoldbergOperator, sympy.Matrix] = {
|
||||
"dk": sympy.Matrix(
|
||||
[
|
||||
[0, 2, 0],
|
||||
@ -203,9 +203,11 @@ goldberg_operators: dict[GoldbergOperator, sympy.Matrix] = {
|
||||
]
|
||||
),
|
||||
}
|
||||
goldberg_operators["tk"] = goldberg_operators["dk"] @ goldberg_operators["dk"]
|
||||
goldberg_operators["g_T"] = from_same_eigenspace(
|
||||
goldberg_operators["dk"], [t_param % 3, 1, t_param]
|
||||
goldberg_matrix_operators["tk"] = (
|
||||
goldberg_matrix_operators["dk"] @ goldberg_matrix_operators["dk"]
|
||||
)
|
||||
goldberg_matrix_operators["g_T"] = from_same_eigenspace(
|
||||
goldberg_matrix_operators["dk"], [t_param % 3, 1, t_param]
|
||||
)
|
||||
|
||||
|
||||
@ -217,7 +219,7 @@ def apply_goldberg_operator(
|
||||
# Naive combinatorial method
|
||||
if isinstance(operator, tuple):
|
||||
return Polyhedron(
|
||||
*(goldberg_operators["g_T"] @ poly.as_matrix()).subs(
|
||||
*(goldberg_matrix_operators["g_T"] @ poly.as_matrix()).subs(
|
||||
t_param, loeschian_norm(*operator)
|
||||
)
|
||||
)
|
||||
@ -225,12 +227,14 @@ def apply_goldberg_operator(
|
||||
# Try lookup parameter
|
||||
if (parameter := goldberg_operators_to_parameters.get(operator)) is not None:
|
||||
return Polyhedron(
|
||||
*(goldberg_operators["g_T"] @ poly.as_matrix()).subs(
|
||||
*(goldberg_matrix_operators["g_T"] @ poly.as_matrix()).subs(
|
||||
t_param, loeschian_norm(*parameter)
|
||||
)
|
||||
)
|
||||
elif (
|
||||
matrix := goldberg_operators.get(operator) # pyright: ignore[reportArgumentType]
|
||||
matrix := goldberg_matrix_operators.get(
|
||||
operator # pyright: ignore[reportArgumentType]
|
||||
)
|
||||
) is not None:
|
||||
return Polyhedron(*(matrix @ poly.as_matrix()))
|
||||
|
||||
@ -240,7 +244,7 @@ def apply_goldberg_operator(
|
||||
partitioned.clear()
|
||||
bad_recipe = False
|
||||
while recipe != "":
|
||||
for op in goldberg_operators.keys():
|
||||
for op in goldberg_matrix_operators.keys():
|
||||
if recipe.find(op) == 0:
|
||||
partitioned.append(op)
|
||||
recipe = recipe[len(op) :]
|
||||
@ -254,7 +258,7 @@ def apply_goldberg_operator(
|
||||
|
||||
if partitioned:
|
||||
# Technically you could just pointwise multiply the eigenvalues
|
||||
matrix = reduce(matmul, (goldberg_operators[i] for i in partitioned))
|
||||
matrix = reduce(matmul, (goldberg_matrix_operators[i] for i in partitioned))
|
||||
return Polyhedron(*(matrix @ poly.as_matrix()))
|
||||
|
||||
raise ValueError("Could not partition operators!")
|
||||
|
||||
@ -38,7 +38,7 @@ from goldberg.display import (
|
||||
)
|
||||
from goldberg.operators import (
|
||||
Polyhedron,
|
||||
goldberg_parameters_to_operations,
|
||||
goldberg_parameters_to_operators,
|
||||
apply_goldberg_operator,
|
||||
)
|
||||
from goldberg.dodecahedral import dodecahedral_goldberg_recipes
|
||||
@ -577,7 +577,7 @@ rows: list[DodecahedralSolution] = [
|
||||
recipe
|
||||
if recipe.find("*") == 0
|
||||
else link_polyhedronisme(
|
||||
display_conway(goldberg_parameters_to_operations[parameter], "D"),
|
||||
display_conway(goldberg_parameters_to_operators[parameter], "D"),
|
||||
recipe,
|
||||
)
|
||||
),
|
||||
|
||||
@ -41,7 +41,7 @@ from goldberg.display import (
|
||||
remove_repeats,
|
||||
)
|
||||
from goldberg.operators import (
|
||||
goldberg_parameters_to_operations,
|
||||
goldberg_parameters_to_operators,
|
||||
goldberg_operators_to_parameters,
|
||||
loeschian_norm,
|
||||
)
|
||||
@ -214,7 +214,7 @@ tet_anti_rows = [
|
||||
truncated_recipe
|
||||
if truncated_recipe.find("*") == 0
|
||||
else link_polyhedronisme(
|
||||
display_conway(goldberg_parameters_to_operations[parameter], "T"),
|
||||
display_conway(goldberg_parameters_to_operators[parameter], "T"),
|
||||
truncated_recipe,
|
||||
)
|
||||
),
|
||||
|
||||
@ -41,12 +41,12 @@ from goldberg.display import (
|
||||
link_polyhedronisme,
|
||||
)
|
||||
from goldberg.operators import (
|
||||
t_param,
|
||||
GoldbergOperator,
|
||||
goldberg_operators,
|
||||
goldberg_matrix_operators,
|
||||
goldberg_operators_to_parameters,
|
||||
loeschian_numbers,
|
||||
loeschian_norm,
|
||||
t_param,
|
||||
)
|
||||
|
||||
n_param, aux_t_param, temp_param = sympy.symbols("n T' x")
|
||||
@ -225,11 +225,11 @@ Diagonalizing each of these operators shows that they have something in common.
|
||||
```{python}
|
||||
# diagonalizing dk gives an eigenspace which shows the 3V = 2E condition
|
||||
# and Euler characteristic more clearly
|
||||
eigenspace, _ = goldberg_operators["dk"].diagonalize()
|
||||
eigenspace, _ = goldberg_matrix_operators["dk"].diagonalize()
|
||||
|
||||
def show_diagonalized(operator: GoldbergOperator):
|
||||
assert operator != "g_T"
|
||||
matrix = goldberg_operators[operator]
|
||||
matrix = goldberg_matrix_operators[operator]
|
||||
diag = eigenspace.inv() @ matrix @ eigenspace
|
||||
|
||||
return f"""{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user