Hodge dual
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.
Definition
Given a rank k abstract temperament on a JI subgroup of dimension n, the mapping M can be written as a [math]\displaystyle{ k \times n }[/math] matrix. Writing the rows of this matrix as [math]\displaystyle{ v_1, \ldots, v_k }[/math], the Plücker coordinates are [math]\displaystyle{ [v_1 \wedge \cdots \wedge v_k] }[/math]. This matrix can also be though of as representing a k-plane, spanned by the rows.
The kernel [math]\displaystyle{ \ker M }[/math], representing the comma space, is an [math]\displaystyle{ (n - k) }[/math]-dimensional subspace of [math]\displaystyle{ \mathbb{R}^n }[/math]. Similarly, if we represent [math]\displaystyle{ \ker M }[/math] by a matrix K, then its Plücker coordinates are [math]\displaystyle{ [w_1 \wedge \cdots \wedge w_{n - k}] }[/math], where \( w_i \) are the columns of K.
The relation between the Plücker coordinates of M and [math]\displaystyle{ \ker M }[/math] is given by the Hodge star, which is an isomorphism:
- [math]\displaystyle{ \star: \Lambda^k \, \mathbb{R}^n \to \Lambda^{n - k} \, \mathbb{R}^n, }[/math]
defined (up to sign) by:
- [math]\displaystyle{ \star (v_1 \wedge \cdots \wedge v_k) = w_1 \wedge \cdots \wedge w_{n - k}, }[/math]
where [math]\displaystyle{ \{w_1, \ldots, w_{n - k}\} }[/math] is a basis for the orthogonal complement of [math]\displaystyle{ \text{span}(v_1, \ldots, v_k) }[/math]. This means the Plücker coordinates of the kernel are given by the Hodge dual of the Plücker coordinates of the row space.
In 3 dimensions, the Hodge star can be computed in the same way as the usual cross product.
- [math]\displaystyle{ \star (u \wedge v) = u \times v }[/math]
This gives the correspondence between vectors and bivectors. A geometrical interpretation is that a plane can represented by the exterior product of two basis vectors. The Hodge dual of this bivector is then the normal vector perpendicular to the plane.
Applying the Hodge star twice leaves a k-vector unchanged, up to sign. For [math]\displaystyle{ \eta \in \Lambda^k \, \mathbb{R}^n }[/math], we have:
- [math]\displaystyle{ \star \star \eta = (-1)^ {k (n-k)} \eta }[/math]
Example
Let's work through the example step-by-step with matrix [math]\displaystyle{ 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]\displaystyle{ \{ e_1, \, e_2, \, e_3 \} }[/math], which correspond the 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:
- [math]\displaystyle{ \frac{81}{80} = 2^{-4} \cdot 3^4 \cdot 5^{-1} \Rightarrow \ker M = \text{span} ( - 4 e_1 + 4 e_2 - e_3 ) }[/math]
The row space of M is spanned by:
- [math]\displaystyle{ v_1 = \begin{pmatrix} 1 & 1 & 0 \end{pmatrix}, \quad v_2 = \begin{pmatrix} 0 & 1 & 4 \end{pmatrix}. }[/math]
The Plücker coordinates are given by [math]\displaystyle{ v_1 \wedge v_2 \in \Lambda^2 \, \mathbb{R}^3 }[/math]. To compute this, take the determinants of all [math]\displaystyle{ 2 \times 2 }[/math] minors of M:
Columns | Determinant | Basis |
---|---|---|
1 & 2 | [math]\displaystyle{ 1 \cdot 1 - 1 \cdot 0 = 1 }[/math] | [math]\displaystyle{ e_1 \wedge e_2 }[/math] |
1 & 3 | [math]\displaystyle{ 1 \cdot 4 - 0 \cdot 0 = 4 }[/math] | [math]\displaystyle{ e_1 \wedge e_3 }[/math] |
2 & 3 | [math]\displaystyle{ 1 \cdot 4 - 0 \cdot 1 = 4 }[/math] | [math]\displaystyle{ e_2 \wedge e_3 }[/math] |
So we have:
- [math]\displaystyle{ v_1 \wedge v_2 = 1 \cdot e_1 \wedge e_2 + 4 \cdot e_1 \wedge e_3 + 4 \cdot e_2 \wedge e_3. }[/math]
In [math]\displaystyle{ \mathbb{R}^3 }[/math], the Hodge star [math]\displaystyle{ \star: \Lambda^2 \, \mathbb{R}^3 \to \Lambda^1 \, \mathbb{R}^3 }[/math] acts on basis elements as:
- [math]\displaystyle{ \begin{align} \star(e_1 \wedge e_2) &= e_3 \\ \star(e_1 \wedge e_3) &= -e_2 \\ \quad \star(e_2 \wedge e_3) &= e_1 \end{align} }[/math]
Applying this to [math]\displaystyle{ v_1 \wedge v_2 }[/math]:
- [math]\displaystyle{ \star(v_1 \wedge v_2) = 1 \cdot \star(e_1 \wedge e_2) + 4 \cdot \star(e_1 \wedge e_3) + 4 \cdot \star(e_2 \wedge e_3) = 1 \cdot e_3 - 4 \cdot e_2 + 4 \cdot e_1. }[/math]
So we find [math]\displaystyle{ \star(v_1 \wedge v_2) = 4e_1 - 4e_2 + e_3 }[/math], 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]\displaystyle{ \ker M }[/math].
Computation
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.
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 (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. C will have the same length as V and M.
- For each combination [math]\displaystyle{ C_i }[/math], compute [math]\displaystyle{ S_i = \sum C_i - \frac{k (k+1)}{2} }[/math].
- Multiply the i-th element of V by [math]\displaystyle{ (-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.
Python implementation of the above algorithm:
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]))
Applications
The Hodge dual can be used to convert between commas and temperaments generally.
For example, if we take 225/224, with coordinates [math]\displaystyle{ w_1 = [-5, 2, 2, -1] }[/math] and 1029/1024, with coordinates [math]\displaystyle{ w_2 = [-10, 1, 0, 3] }[/math], we can find:
- [math]\displaystyle{ K = w_1 \wedge w_2 = [15, 20, -25, -2, 7, 6] . }[/math]
The Hodge dual is [math]\displaystyle{ \star K = [6, -7, -2, -25, -20, 15] }[/math], which are the Plücker coordinates for miracle.