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