Hodge dual: Difference between revisions

Wikispaces>genewardsmith
**Imported revision 294102036 - Original comment: **
Sintel (talk | contribs)
delete wedgie entirely
 
(37 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-21 12:03:49 UTC</tt>.<br>
: The original revision id was <tt>294102036</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">[[toc|flat]]


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.
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.


=The bracket=
== Definition ==
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 of the 7-limit patent vals 612 and 441, W = 612∧441 = &lt;&lt;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 = |0 3 -2 0&gt;∧|-2 1 -1 1&gt; = ||6 -4 0 -1 3 -2&gt;&gt;. Then &lt;W|M&gt; equals &lt;&lt;18 27 18 1 -22 -34||6 -4 0 -1 3 -2&gt;&gt; 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]], but then we must fuss about the sign.  
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.


=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>.
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 &lt;U|Vº&gt; = U∧V for every k-multival U.
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.


=Computing the dual=
The relation between the Plücker coordinates of M and <math>\ker M</math> is given by the '''Hodge star''', which is an isomorphism:
We can see how to go about computing the dual by looking at the dual of wedge products of basis elements. If we have n basis elements B = {b1, b2, ..., bn}, then if we have a k-fold wedge product of k of these basis elements in order, we may subtract the set of these k elements {bi}, in the sense of set theory subtraction, from B. In other words, if we have a k-fold product of basis elements X in order, we may take the corresponding (n-k)-fold product Y of all the remaining basis elements in order. Then X∧Y will be 1 if X concatenated with Y gives an even permutation, and -1 if it gives on odd permutation. Hence, we may take the (n-i)th element of the k-vector, and this becomes the ith element of the dual if the permutation of the k basis elements in order, concatenated with the remaining (n-k) elements in order, is an even permutation. If it is an odd permutation, then minus the (n-i)th element becomes the ith element of the dual.
:<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.


=Using the dual=
In 3 dimensions, the Hodge star can be computed in the same way as the usual cross product.
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 = |0 3 -2 0&gt;∧|-2 1 -1 1&gt;, which is ||6 -4 0 -1 3 -2&gt;&gt;, considered above, we may find the dual Mº as ||6 -4 0 -1 3 -2&gt;&gt;º = &lt;&lt;-2 -3 -1 0 4 6||. Normalizing this to a wedgie gives &lt;&lt;2 3 1 0 -4 -6||, the wedgie for bug temperament. Then if W is the wedgie for ennealimmal considered above, W∧Mº = &lt;W|M&gt; = 1. We can also take a multival, and use the dual to get a corresponding mulitmonzo, 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.</pre></div>
:<math>
<h4>Original HTML content:</h4>
\star (u \wedge v) = u \times v
<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;&lt;!-- ws:start:WikiTextTocRule:8:&amp;lt;img id=&amp;quot;wikitext@@toc@@flat&amp;quot; class=&amp;quot;WikiMedia WikiMediaTocFlat&amp;quot; title=&amp;quot;Table of Contents&amp;quot; src=&amp;quot;/site/embedthumbnail/toc/flat?w=100&amp;amp;h=16&amp;quot;/&amp;gt; --&gt;&lt;!-- ws:end:WikiTextTocRule:8 --&gt;&lt;!-- ws:start:WikiTextTocRule:9: --&gt;&lt;a href="#The bracket"&gt;The bracket&lt;/a&gt;&lt;!-- ws:end:WikiTextTocRule:9 --&gt;&lt;!-- ws:start:WikiTextTocRule:10: --&gt; | &lt;a href="#The dual"&gt;The dual&lt;/a&gt;&lt;!-- ws:end:WikiTextTocRule:10 --&gt;&lt;!-- ws:start:WikiTextTocRule:11: --&gt; | &lt;a href="#Computing the dual"&gt;Computing the dual&lt;/a&gt;&lt;!-- ws:end:WikiTextTocRule:11 --&gt;&lt;!-- ws:start:WikiTextTocRule:12: --&gt; | &lt;a href="#Using the dual"&gt;Using the dual&lt;/a&gt;&lt;!-- ws:end:WikiTextTocRule:12 --&gt;&lt;!-- ws:start:WikiTextTocRule:13: --&gt;
</math>
&lt;!-- ws:end:WikiTextTocRule:13 --&gt;&lt;br /&gt;
This gives the correspondence between vectors and bivectors.
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;
A geometrical interpretation is that a plane can represented by the exterior product of two basis vectors.
&lt;br /&gt;
The Hodge dual of this bivector is then the normal vector perpendicular to the plane.
&lt;!-- ws:start:WikiTextHeadingRule:0:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc0"&gt;&lt;a name="The bracket"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:0 --&gt;The bracket&lt;/h1&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 of the 7-limit patent vals 612 and 441, 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. Then 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; = ||6 -4 0 -1 3 -2&amp;gt;&amp;gt;. Then &amp;lt;W|M&amp;gt; equals &amp;lt;&amp;lt;18 27 18 1 -22 -34||6 -4 0 -1 3 -2&amp;gt;&amp;gt; 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 &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;
Applying the Hodge star twice leaves a ''k''-vector unchanged, up to sign.
&lt;br /&gt;
For <math> \eta \in \Lambda^k \, \mathbb{R}^n</math>, we have:
&lt;!-- ws:start:WikiTextHeadingRule:2:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc1"&gt;&lt;a name="The dual"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:2 --&gt;The dual&lt;/h1&gt;
:<math>
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 &amp;lt;U|Vº&amp;gt; = U∧V for every k-multival U.&lt;br /&gt;
\star \star \eta = (-1)^ {k (n-k)} \eta
&lt;br /&gt;
</math>
&lt;!-- ws:start:WikiTextHeadingRule:4:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc2"&gt;&lt;a name="Computing the dual"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:4 --&gt;Computing the dual&lt;/h1&gt;
 
We can see how to go about computing the dual by looking at the dual of wedge products of basis elements. If we have n basis elements B = {b1, b2, ..., bn}, then if we have a k-fold wedge product of k of these basis elements in order, we may subtract the set of these k elements {bi}, in the sense of set theory subtraction, from B. In other words, if we have a k-fold product of basis elements X in order, we may take the corresponding (n-k)-fold product Y of all the remaining basis elements in order. Then X∧Y will be 1 if X concatenated with Y gives an even permutation, and -1 if it gives on odd permutation. Hence, we may take the (n-i)th element of the k-vector, and this becomes the ith element of the dual if the permutation of the k basis elements in order, concatenated with the remaining (n-k) elements in order, is an even permutation. If it is an odd permutation, then minus the (n-i)th element becomes the ith element of the dual.&lt;br /&gt;
== Example ==
&lt;br /&gt;
 
&lt;!-- ws:start:WikiTextHeadingRule:6:&amp;lt;h1&amp;gt; --&gt;&lt;h1 id="toc3"&gt;&lt;a name="Using the dual"&gt;&lt;/a&gt;&lt;!-- ws:end:WikiTextHeadingRule:6 --&gt;Using the dual&lt;/h1&gt;
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]].
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 = |0 3 -2 0&amp;gt;∧|-2 1 -1 1&amp;gt;, which is ||6 -4 0 -1 3 -2&amp;gt;&amp;gt;, considered above, we may find the dual Mº as ||6 -4 0 -1 3 -2&amp;gt;&amp;gt;º = &amp;lt;&amp;lt;-2 -3 -1 0 4 6||. Normalizing this to a wedgie gives &amp;lt;&amp;lt;2 3 1 0 -4 -6||, the wedgie for bug temperament. Then if W is the wedgie for ennealimmal considered above, W∧Mº = &amp;lt;W|M&amp;gt; = 1. We can also take a multival, and use the dual to get a corresponding mulitmonzo, and then use the same method described on the &lt;a class="wiki_link" href="/abstract%20regular%20temperament"&gt;abstract regular temperament&lt;/a&gt; page for extracting a normal val list from a multival to get a normal comma list from the multimonzo.&lt;/body&gt;&lt;/html&gt;</pre></div>
 
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]]