Hodge dual: Difference between revisions

Wikispaces>genewardsmith
**Imported revision 289009707 - Original comment: **
Sintel (talk | contribs)
delete wedgie entirely
 
(45 intermediate revisions by 10 users not shown)
Line 1: Line 1:
<h2>IMPORTED REVISION FROM WIKISPACES</h2>
{{wikipedia|Hodge star operator}}
This is an imported revision from Wikispaces. The revision metadata is included below for reference:<br>
: This revision was by author [[User:genewardsmith|genewardsmith]] and made on <tt>2012-01-01 21:56:59 UTC</tt>.<br>
: The original revision id was <tt>289009707</tt>.<br>
: The revision comment was: <tt></tt><br>
The revision contents are below, presented both in the original Wikispaces Wikitext format, and in HTML exactly as Wikispaces rendered it.<br>
<h4>Original Wikitext content:</h4>
<div style="width:100%; max-height:400pt; overflow:auto; background-color:#f8f9fa; border: 1px solid #eaecf0; padding:0em"><pre style="margin:0px;border:none;background:none;word-wrap:break-word;white-space: pre-wrap ! important" class="old-revision-html">Given a k-multival W, there is a //dual// k-multimonzo Wº. Similarly, given a k-multimonzo M, there is a dual k-multival Mº. The dual may be defined in terms of the bracket product relating multivals and multimonzos, which we discuss first.


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, &lt;W|M&gt;, acts just the same as the bracket product of a val with a monzo. Suppose, for example, we take the wedge product W = 612∧441 = &lt;&lt;18 27 18 1 -22 -34||, which is the wedgie for ennealimmal temperament, and is a 2-val. The suppose we take the wedge product of the monzos for 27/25 and 21/20, M = |0 3 -2 0&gt;∧|-2 1 -1 1&gt; = ||6 -4 0 -1 3 -2&gt;&gt;. Them &lt;W|M&gt; = &lt;&lt;18 27 18 1 -22 -34||6 -4 0 -1 3 -2&gt;&gt; = 18*6-27*4+18*0-1*1-22*3+34*2 = 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]], but then we must fuss about the sign.  
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 U and an (n-k)-multival V, where n is the dimension (the number of coeifficients, 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 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 &lt;U|Vº&gt; = U∧V for every k-multival U.
== Definition ==
</pre></div>
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.
<h4>Original HTML content:</h4>
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>.
<div style="width:100%; max-height:400pt; overflow:auto; background-color:#f8f9fa; border: 1px solid #eaecf0; padding:0em"><pre style="margin:0px;border:none;background:none;word-wrap:break-word;width:200%;white-space: pre-wrap ! important" class="old-revision-html">&lt;html&gt;&lt;head&gt;&lt;title&gt;The dual&lt;/title&gt;&lt;/head&gt;&lt;body&gt;Given a k-multival W, there is a &lt;em&gt;dual&lt;/em&gt; k-multimonzo Wº. Similarly, given a k-multimonzo M, there is a dual k-multival Mº. The dual may be defined in terms of the bracket product relating multivals and multimonzos, which we discuss first.&lt;br /&gt;
This matrix can also be though of as representing a ''k''-plane, spanned by the rows.
&lt;br /&gt;
 
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, &amp;lt;W|M&amp;gt;, acts just the same as the bracket product of a val with a monzo. Suppose, for example, we take the wedge product W = 612∧441 = &amp;lt;&amp;lt;18 27 18 1 -22 -34||, which is the wedgie for ennealimmal temperament, and is a 2-val. The suppose we take the wedge product of the monzos for 27/25 and 21/20, M = |0 3 -2 0&amp;gt;∧|-2 1 -1 1&amp;gt;  &lt;!-- ws:start:WikiTextHeadingRule:0:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc0"&gt;&lt;a name="x||6 -4 0 -1 3 -2&amp;gt;&amp;gt;. Them"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:0 --&gt; ||6 -4 0 -1 3 -2&amp;gt;&amp;gt;. Them &amp;lt;W|M&amp;gt; &lt;/h1&gt;
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>.
&amp;lt;&amp;lt;18 27 18 1 -22 -34||6 -4 0 -1 3 -2&amp;gt;&amp;gt;  &lt;!-- ws:start:WikiTextHeadingRule:2:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc1"&gt;&lt;a name="x18*6-27*4+18*0-1*1-22*3+34*2"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:2 --&gt; 18*6-27*4+18*0-1*1-22*3+34*2 &lt;/h1&gt;
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. 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 &lt;a class="wiki_link" href="/interior%20product"&gt;interior product&lt;/a&gt;, but then we must fuss about the sign. &lt;br /&gt;
 
&lt;br /&gt;
The relation between the Plücker coordinates of M and <math>\ker M</math> is given by the '''Hodge star''', which is an isomorphism:
Given a k-multival U and an (n-k)-multival V, where n is the dimension (the number of coeifficients, 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 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 &amp;lt;U|Vº&amp;gt; = U∧V for every k-multival U.&lt;/body&gt;&lt;/html&gt;</pre></div>
:<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.
 
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.
 
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>
 
== Example ==
 
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 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>
 
The row space of M is spanned by:
:<math>
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>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]]