Hodge dual: Difference between revisions

Sintel (talk | contribs)
Sintel (talk | contribs)
delete wedgie entirely
 
(3 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 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 ==