Hodge dual: Difference between revisions

Sintel (talk | contribs)
Give proper definition and a fully worked out example
Sintel (talk | contribs)
delete wedgie entirely
 
(6 intermediate revisions by the same user not shown)
Line 4: Line 4:


== Definition ==
== Definition ==
Given a rank ''k'' temperament on a JI subgroup of dimension ''n'', the mapping M can be written as a <math>k \times n</math> matrix.
Given a rank ''k'' [[abstract temperament]] on a [[JI subgroup]] of dimension ''n'', the [[mapping]] M can be written as a <math>k \times n</math> matrix.
Writing the rows of this matrix as <math>v_1, \ldots, v_k</math>, the Plücker coordinates are <math>[v_1 \wedge \cdots \wedge v_k]</math>.
Writing the rows of this matrix as <math>v_1, \ldots, v_k</math>, the Plücker coordinates are <math>[v_1 \wedge \cdots \wedge v_k]</math>.
This matrix can also be though of as representing a ''k''-plane, spanned by the rows.
This matrix can also be though of as representing a ''k''-plane, spanned by the rows.


The kernel <math>\ker M</math>, representing the comma space, is an <math>(n - k)</math>-dimensional subspace of <math> \mathbb{R}^n </math>.
The kernel <math>\ker M</math>, representing the [[comma basis|comma space]], is an <math>(n - k)</math>-dimensional subspace of <math> \mathbb{R}^n </math>.
Similarly, if we represent <math>\ker M</math> by a matrix K, then its Plücker coordinates are <math>[w_1 \wedge \cdots \wedge w_{n - k}]</math>, where \( w_i \) are the columns of K.
Similarly, if we represent <math>\ker M</math> by a matrix K, then its Plücker coordinates are <math>[w_1 \wedge \cdots \wedge w_{n - k}]</math>, where \( w_i \) are the columns of K.


Line 87: Line 87:
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>.


== Computing the Hodge dual ==
== Computation ==
Again 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
The Hodge dual can be computed quickly by realizing that if we write the basis in lexicographic order, we only have to reverse the coefficients and change some signs.


# Let '''C''' be the ''k''-combinations of the numbers 1 through ''n'' in lexicographic order
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:
# '''C''' will have the same length as '''V''' and '''M'''
# 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 −1<sup>'''S'''<sub>''i''</sub></sup>


and then reverse the elements of '''V'''.
# 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'''.
# For each combination <math>C_i</math>, compute <math>S_i = \sum C_i - \frac{k (k+1)}{2}</math>.
# Multiply the ''i''-th element of '''V''' by <math>(-1)^{S_i}</math>.
# Reverse the elements of '''V'''.


To find an unknown '''V''' from a known '''M''', first reverse '''M''' and then adjust the signs.
To find an unknown '''V''' from a known '''M''', first reverse '''M''' and then adjust the signs.


== Using the dual ==
Python implementation of the above algorithm:
The dual allows one to find the wedgie, which is a normalized multival, by wedging together monzos and then taking the dual. For instance from {{nowrap| '''M''' {{=}} {{monzo| 0 3 -2 0 }} ∧ {{monzo| -2 1 -1 1 }} }}, which is {{multimonzo| 6 -4 0 -1 3 -2 }}, considered above, we may find the dual '''M'''° as {{nowrap| {{multimonzo|6 -4 0 -1 3 -2}}° {{=}} {{multival| -2 -3 -1 0 4 6 }} }}. Normalizing this to a wedgie gives {{multival| 2 3 1 0 -4 -6 }}, the wedgie for bug temperament. Then if '''W''' is the wedgie for ennealimmal considered above, {{nowrap| '''W''' ∧ '''M'''° {{=}} {{wmp| '''W'''|M}} {{=}} 1 }}. We can also take a multival, and use the dual to get a corresponding multimonzo, and then use the same method described on the [[abstract regular temperament]] page for extracting a normal val list from a multival to get a normal comma list from the multimonzo.
{{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}")
 
    # 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 ==
The Hodge dual can be used to convert between commas and temperaments generally.
 
For example, if we take [[225/224]], with coordinates <math>w_1 = [-5, 2, 2, -1]</math> and [[1029/1024]], with coordinates <math>w_2 = [-10, 1, 0, 3]</math>, we can find:
:<math>
K = w_1 \wedge w_2 = [15, 20, -25, -2, 7, 6] .
</math>
 
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 ==