Hodge dual: Difference between revisions

Sintel (talk | contribs)
Definition: linking
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{wikipedia|Hodge star operator}}
{{wikipedia|Hodge star operator}}


In [[exterior algebra]] applied to [[regular temperament theory]], the '''Hodge dual''', or '''Hodge star''' is an operation that converts the [[Plücker coordinates]] of a temperament into the corresponding coordinates of the [[comma basis]], and vice versa.
In [[exterior algebra]] applied to [[regular temperament theory]], the '''Hodge dual''', or '''Hodge star''' is an operation that converts the [[Plücker coordinates]] (or [[wedgie]]) of a temperament into the corresponding coordinates of the [[comma basis]] (a kind of "comma wedgie"), and vice versa.


== Definition ==
== Definition ==
Line 40: Line 40:
Let's work through the example step-by-step with matrix <math>M = \begin{bmatrix} 1 & 1 & 0 \\ 0 & 1 & 4 \end{bmatrix}</math>, the mapping matrix of 5-limit [[meantone]].
Let's work through the example step-by-step with matrix <math>M = \begin{bmatrix} 1 & 1 & 0 \\ 0 & 1 & 4 \end{bmatrix}</math>, the mapping matrix of 5-limit [[meantone]].


We will write the standard basis vectors as <math>\{ e_1, \, e_2, \, e_3 \}</math>, which correspond the the primes 2, 3 and 5 respectively.
We will write the standard basis vectors as <math>\{ e_1, \, e_2, \, e_3 \}</math>, which correspond to the primes 2, 3 and 5 respectively.
We already know that the kernel of this mapping should be [[81/80]], so we can write the kernel as:
We already know that the kernel of this mapping should be [[81/80]], so we can write the kernel as:
:<math>
:<math>
Line 84: Line 84:
</math>
</math>


So we find <math>\star(v_1 \wedge v_2) = 4e_1 - 4e_2 + e_3</math>, which matches with what we expect from above, up to sign.
So we find <math>\star(v_1 \wedge v_2) = 4e_1 - 4e_2 + e_3</math> (which is the monzo for the descending syntonic comma), which matches with what we expect from above, up to sign.
The Hodge dual \( \star(v_1 \wedge v_2) \) directly gives the generator of <math> \ker M </math>.
The Hodge dual \( \star(v_1 \wedge v_2) \) directly gives the generator of <math> \ker M </math>.


Line 92: Line 92:
With a basis of dimension ''n'', suppose we have a ''k''-form '''V''' and wish to find its dual '''M'''. The elements of '''V''' are associated with ''k''-combinations, and of '''M''' with {{nowrap|(''n'' − ''k'')}}-combinations, of the basis elements. Because of the symmetry of binomial coefficients, '''V''' and '''M''' will have the same length. To find '''M''' we adjust the signs of '''V''' with the following procedure:
With a basis of dimension ''n'', suppose we have a ''k''-form '''V''' and wish to find its dual '''M'''. The elements of '''V''' are associated with ''k''-combinations, and of '''M''' with {{nowrap|(''n'' − ''k'')}}-combinations, of the basis elements. Because of the symmetry of binomial coefficients, '''V''' and '''M''' will have the same length. To find '''M''' we adjust the signs of '''V''' with the following procedure:


# Let '''C''' be the ''k''-combinations of the numbers 1 through ''n'' in lexicographic order
# Let '''C''' be the ''k''-combinations of the numbers 1 through ''n'' in lexicographic order. '''C''' will have the same length as '''V''' and '''M'''.
# '''C''' will have the same length as '''V''' and '''M'''
# For each combination <math>C_i</math>, compute <math>S_i = \sum C_i - \frac{k (k+1)}{2}</math>.
# Sum the numbers in each combination '''C'''<sub>''i''</sub> with ceil(''k''/2) to find '''S'''<sub>''i''</sub>
# Multiply the ''i''-th element of '''V''' by <math>(-1)^{S_i}</math>.
# Multiply the ''i''th element of ''V'' by −1<sup>'''S'''<sub>''i''</sub></sup>
# Reverse the elements of '''V'''.


and then reverse the elements of '''V'''.
To find an unknown '''V''' from a known '''M''', first reverse '''M''' and then adjust the signs.
 
Python implementation of the above algorithm:
{{Databox| Code |
<syntaxhighlight lang="python">
import itertools
import math
 
 
def hodge_dual(n, k, v):
    N = math.comb(n, k)
    if len(v) != N:
        raise ValueError(f"Length of v must be {N}")


To find an unknown '''V''' from a known '''M''', first reverse '''M''' and then adjust the signs.
    # Generate lex-ordered k-indices (tuples)
    indices_list = list(itertools.combinations(range(1, n + 1), k))
 
    # k-th triangular number
    T0 = k * (k + 1) // 2
    w = [0] * N
 
    for i, I in enumerate(indices_list):
        total = sum(I)
        exponent = total - T0
        s = 1 if exponent % 2 == 0 else -1
        j = N - 1 - i  # Position in dual vector (reverse lex order)
        w[j] = s * v[i]
 
    return w
 
 
if __name__ == "__main__":
    n = 3
    k = 2
 
    # Output: [4, -4, 1]
    print(hodge_dual(n, k, [1, 4, 4]))
</syntaxhighlight>
}}


== Applications ==
== Applications ==
Line 109: Line 145:
</math>
</math>


The Hodge dual is <math>\star K = [6, -7, -2, -25, -20, 15]</math>, which are the Plücker coordinates (a.k.a. [[wedgie]]) for [[miracle]].
The Hodge dual is <math>\star K = [6, -7, -2, -25, -20, 15]</math>, which are the Plücker coordinates for [[miracle]].


== See also ==
== See also ==