Hodge dual: Difference between revisions

Mike Battaglia (talk | contribs)
m Protected "The dual" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
Sintel (talk | contribs)
delete wedgie entirely
 
(22 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Given n basis elements (i.e. the number of primes in a prime limit) and a k-multival W in this basis, there is a ''dual'' (n-k)-multimonzo W°. Similarly, given a k-multimonzo M, there is a dual (n-k)-multival Mº. The dual may be defined in terms of the bracket product relating multivals and multimonzos, which we discuss first.
{{wikipedia|Hodge star operator}}


=The bracket=
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.
Given a k-multival W and a k-multimonzo M (in which we may include sums of k-fold wedge products of vals or monzos), the bracket or bracket product, ⟨W|M⟩, acts just the same as the bracket product of a val with a monzo. Suppose, for example, we take the wedge product of the 7-limit patent vals 612 and 441, W = 612∧441 = {{wedgie|18 27 18 1 -22 -34}}, which is the wedgie for ennealimmal temperament, and is a 2-val. Then suppose we take the wedge product of the monzos for 27/25 and 21/20, M = {{monzo|0 3 -2 0}}∧{{monzo|-2 1 -1 1}} = {{multimonzo|6 -4 0 -1 3 -2}}. Then ⟨W|M⟩ equals {{wedgie|18 27 18 1 -22 -34}}{{multimonzo|6 -4 0 -1 3 -2}} equals 18*6-27*4+18*0-1*1-22*3+34*2 equals 1. In fact, we can compute the same result just using the vals and monzos we wedge together to get the bivals and bimonzos, by taking the determinant of the matrix which is the product of the matrix with rows the vals with the matrix with monzos the columns. We can also define it via the [[Interior_product|interior product]], but then we must fuss about the sign.  


=The dual=
== Definition ==
Given a k-multival U and an (n-k)-multival V, where n is the dimension (the number of coefficients, or length) of the vals, then U∧V is an n-multival. But the space of n-multivals is one-dimensional; if e2, e3, ..., ep is the standard basis of prime vals, then e2∧e3∧...∧ep is the sole basis vector for n-multivals. Hence by a slight abuse of notation it can be identified as a single scalar quantity. Given that identification, the dual V° of V is simply the k-multimonzo which has the property that ⟨U|V°⟩ = U∧V for every k-multival U.
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>.
This matrix can also be though of as representing a ''k''-plane, spanned by the rows.


=Computing the dual=
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>.
Again with a basis of dimension n, suppose we have a k-multival V and wish to find its dual multimonzo 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
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.


1. Let C be the k-combinations of the numbers 1..n in lexicographic order
The relation between the Plücker coordinates of M and <math>\ker M</math> is given by the '''Hodge star''', which is an isomorphism:
:<math>
\star: \Lambda^k \, \mathbb{R}^n \to \Lambda^{n - k} \, \mathbb{R}^n,
</math>
defined (up to sign) by:
:<math>
\star (v_1 \wedge \cdots \wedge v_k) = w_1 \wedge \cdots \wedge w_{n - k},
</math>
where <math>\{w_1, \ldots, w_{n - k}\}</math> is a basis for the orthogonal complement of <math>\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.


2. C will have the same length as V and M
In 3 dimensions, the Hodge star can be computed in the same way as the usual cross product.
:<math>
\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.


3. Sum the numbers in each combination Ci with ceil(k/2) to find Si
Applying the Hodge star twice leaves a ''k''-vector unchanged, up to sign.
For <math> \eta \in \Lambda^k \, \mathbb{R}^n</math>, we have:
:<math>
\star \star \eta = (-1)^ {k (n-k)} \eta
</math>


4. Multiply the ith element of V by -1^(Si)
== Example ==


and then reverse the elements of V.
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]].


To find an unknown V from a known M, first reverse M and then adjust the signs.
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 already know that the kernel of this mapping should be [[81/80]], so we can write the kernel as:
:<math>
\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>


=Using the dual=
The row space of M is spanned by:
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 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 {{multimonzo|6 -4 0 -1 3 -2}}° = {{wedgie|-2 -3 -1 0 4 6}}. Normalizing this to a wedgie gives {{wedgie|2 3 1 0 -4 -6}}, the wedgie for bug temperament. Then if W is the wedgie for ennealimmal considered above, W∧M° = ⟨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|abstract regular temperament]] page for extracting a normal val list from a multival to get a normal comma list from the multimonzo.
:<math>
v_1 = \begin{pmatrix} 1 & 1 & 0 \end{pmatrix}, \quad v_2 = \begin{pmatrix} 0 & 1 & 4 \end{pmatrix}.
</math>


[[Category:EA]]
The Plücker coordinates are given by <math>v_1 \wedge v_2 \in \Lambda^2 \, \mathbb{R}^3</math>. To compute this, take the determinants of all <math>2 \times 2</math> minors of M:
 
{| class="wikitable"
|-
! Columns !! Determinant !! Basis
|-
| 1 & 2 || <math>1 \cdot 1 - 1 \cdot 0 = 1</math> || <math>e_1 \wedge e_2</math>
|-
| 1 & 3 || <math>1 \cdot 4 - 0 \cdot 0 = 4</math> || <math>e_1 \wedge e_3</math>
|-
| 2 & 3 || <math>1 \cdot 4 - 0 \cdot 1 = 4</math> || <math>e_2 \wedge e_3</math>
|}
 
So we have:
:<math>
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> \mathbb{R}^3 </math>, the Hodge star <math> \star: \Lambda^2 \, \mathbb{R}^3 \to \Lambda^1 \, \mathbb{R}^3 </math> acts on basis elements as:
:<math>
\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> v_1 \wedge v_2 </math>:
:<math>
\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>\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> \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 {{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. '''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.
 
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}")
 
    # 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 ==
* [[Dave Keenan & Douglas Blumeyer's guide to EA for RTT#The dual]]
 
[[Category:Exterior algebra]]