Wedgie: Difference between revisions
No edit summary |
→Conversion: complete |
||
| (7 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
{{Beginner|Plücker coordinates}} | {{Beginner|Plücker coordinates}} | ||
A '''wedgie''' is | A '''wedgie''' is a primarily mathematical object that uniquely characterizes a [[regular temperament]] regardless of choice of [[period]] and [[generator]], which can therefore provide some illuminating information beyond the [[mapping|mapping matrix]]. A wedgie takes the form ⟨⟨…⟨ ''w''<sub>1</sub> ''w''<sub>2</sub> … ''w''<sub>''n''</sub> ]]…], with ''n'' entries listed in between multiple [[val]] brackets (double brackets for rank-2, triple brackets for rank-3, and so on). Wedgies can be thought of as a generalization of vals, called ''multivals'', so that a val is a wedgie for a rank-1 temperament. Each element conveys information about the structure of a set of primes in the temperament, containing a number of primes equivalent to the temperament's rank. | ||
While wedgies have served as a canonical way to represent temperaments mathematically due to their generator-agnostic nature, their musical utility is not obvious – [[mapping|mappings]] would often be of more immediate use to musicians. | |||
== How to read a wedgie == | == How to read a wedgie == | ||
One way to characterize temperaments is by how many parts they split important intervals into – for example, the octave and the perfect fifth. The [[ploidacot]] system works under this principle, and the reader is encouraged to be familiarized with it. | |||
For any n-prime subgroup of a rank-n temperament, there exist a finite number (1 or more) of copies of that subgroup within the temperament. Think of these as "universes" that are connected exclusively by intervals of that subgroup and may be travelled between by using intervals outside the subgroup. For example, a temperament that is [[Ploidacot/Diploid dicot|diploid dicot]] | For any ''n''-prime subgroup of a rank-''n'' temperament, there exist a finite number (1 or more) of copies of that subgroup within the temperament. Think of these as "universes" that are connected exclusively by intervals of that subgroup and may be travelled between by using intervals outside the subgroup. For example, a temperament that is [[Ploidacot/Diploid dicot|diploid dicot]] – dividing the octave into two parts and also dividing the perfect fifth into two parts – will have a 2.3 wedgie entry of 4 (since there are four distinct copies of the 3-limit – the basic 3-limit, offset by a neutral third, offset by a semioctave, and offset by both). Each wedgie entry counts the number of copies of its corresponding subgroup. Because any temperament can be defined by splitting some interval and assigning the parts just interpretations, this is enough to uniquely characterize the temperament. | ||
=== Example 1: | === Example 1: meantone === | ||
The wedgie for meantone is {{multival| 1 4 4 }}. Each entry corresponds to a pair of primes: 2.3, 2.5, and 3.5. The first entry of the wedgie is the ploidacot signatures multiplied together, which in this case is 1, because the octave finds 2 at one step, and the fifth finds 3 at one generator minus one octave (which, since there are no even splits, still counts as 1). | |||
For 2.5, the procedure generalizes, with the entry, 4, being the number of steps 2 and 5 are divided into respectively multiplied together; that is, the number of parts into which the 2.5 subgroup is split. But since we already know 2 is divided into only one octave, this must mean 5 is split into four parts. In fact, 5 is found at four fifths up. | For 2.5, the procedure generalizes, with the entry, 4, being the number of steps 2 and 5 are divided into respectively multiplied together; that is, the number of parts into which the 2.5 subgroup is split. But since we already know 2 is divided into only one octave, this must mean 5 is split into four parts. In fact, 5 is found at four fifths up. | ||
| Line 15: | Line 17: | ||
For the final entry, which is for the 3.5 subgroup, we have another 4. But this time, we are thinking tritave-equivalently now, so we will be reaching 5/3. This is the number of parts 3 and 5/3 are divided into respectively, multiplied together. 3 is reached by going up one 3/2 and one 2/1, but no splitting is happening, so the factor of 4 must come from 5/3, which is indeed reached by four 3/2's. | For the final entry, which is for the 3.5 subgroup, we have another 4. But this time, we are thinking tritave-equivalently now, so we will be reaching 5/3. This is the number of parts 3 and 5/3 are divided into respectively, multiplied together. 3 is reached by going up one 3/2 and one 2/1, but no splitting is happening, so the factor of 4 must come from 5/3, which is indeed reached by four 3/2's. | ||
=== Example 2: | === Example 2: father === | ||
For another example, take father, which has the wedgie {{multival| 1 -1 -4 }}. | For another example, take father, which has the wedgie {{multival| 1 -1 -4 }}. | ||
| Line 24: | Line 26: | ||
Finally, for 3.5, we have the entry -4. Again, we are tritave-equivalent and 3/1 is simply found by an octave and a fifth, so we will be finding 5/3 by splitting it into four parts. 5/3 is equated to 16/9 in father, which is found by going up two octaves and down two fifths. This might seem like only a split into two, but keep in mind - we are in tritave-equivalent territory. Octaves are the tritave complement of fifths. So instead of going up two octaves, we can instead simply go down two more fifths to reach 5/3. And there we have it – 5/3 is split into four parts, which each contain a negative generator. | Finally, for 3.5, we have the entry -4. Again, we are tritave-equivalent and 3/1 is simply found by an octave and a fifth, so we will be finding 5/3 by splitting it into four parts. 5/3 is equated to 16/9 in father, which is found by going up two octaves and down two fifths. This might seem like only a split into two, but keep in mind - we are in tritave-equivalent territory. Octaves are the tritave complement of fifths. So instead of going up two octaves, we can instead simply go down two more fifths to reach 5/3. And there we have it – 5/3 is split into four parts, which each contain a negative generator. | ||
=== Example 3: | === Example 3: blackwood === | ||
For our final example, we will consider blackwood {{multival| 0 5 8 }}. | For our final example, we will consider blackwood {{multival| 0 5 8 }}. | ||
| Line 38: | Line 40: | ||
For wedgies of higher-rank temperaments, the number of primes per entry is increased, so that for a rank-3 temperament of the 7-limit, all possible combinations of 3 primes (2.3.5, 2.3.7, 2.5.7, and 3.5.7) would be covered. | For wedgies of higher-rank temperaments, the number of primes per entry is increased, so that for a rank-3 temperament of the 7-limit, all possible combinations of 3 primes (2.3.5, 2.3.7, 2.5.7, and 3.5.7) would be covered. | ||
== | == Form of a wedgie == | ||
A wedgie is essentially a compressed ''r''-dimensional {{w|antisymmetric tensor}}. | |||
For rank-2 temperaments, this becomes an {{w|antisymmetric matrix}}. In particular, the notation being used previously, {{multival| ''x'' ''y'' ''z'' }}, is formally a shorthand for a matrix form, written | |||
$$ | $$ | ||
| Line 49: | Line 53: | ||
$$ | $$ | ||
For a wedgie on a 4-prime subgroup, the structure of {{multival| a b c d e f }} is actually | For a wedgie on a 4-prime subgroup, the structure of {{multival| ''a'' ''b'' ''c'' ''d'' ''e'' ''f'' }} is actually | ||
$$ | $$ | ||
| Line 71: | Line 75: | ||
== Conversion == | == Conversion == | ||
=== Mapping matrix to wedgie === | === Mapping matrix to wedgie === | ||
The wedgie may be found from the mapping by taking the {{w|determinant}}s of the mapping's column slices that correspond to all the combinations of formal primes. | The wedgie may be found from the mapping by taking the {{w|determinant}}s of the mapping's column slices that correspond to all the combinations of formal primes. Below is a minimalistic [https://www.python.org/ Python] script that finds the wedgie from a mapping matrix, using [https://scipy.org/ SciPy]. | ||
Below is a [https://www.python.org/ Python] script that finds the wedgie from a mapping matrix, using [https://scipy.org/ | |||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
| Line 80: | Line 82: | ||
from scipy import linalg | from scipy import linalg | ||
def | def breeds2wedgie (breeds): | ||
combinations = itertools.combinations (range ( | """Takes a mapping, returns the corresponding wedgie. """ | ||
wedgie = np.array ([linalg.det (breeds[:, entry]) for entry in combinations]) | |||
r, d = breeds.shape # rank and dimensionality | |||
combinations = itertools.combinations (range (d), r) | |||
wedgie = np.array ([linalg.det (breeds[:, entry]) for entry in combinations], ndmin = r) | |||
# normalize for a positive first entry | # normalize for a positive first entry | ||
# unneeded if the mapping is in canonical form | # unneeded if the mapping is in canonical form | ||
if wedgie[0] < 0: | if wedgie.flat[0] < 0: | ||
wedgie *= -1 | wedgie *= -1 | ||
| Line 98: | Line 103: | ||
=== Wedgie to mapping matrix === | === Wedgie to mapping matrix === | ||
Converting, or ''decomposing'', a wedgie to a mapping matrix is much more complicated. [[Gene Ward Smith]]'s provided an algorithm, explained in [[Dave Keenan & Douglas Blumeyer's guide to EA for RTT #Gene's algorithm]], and implemented in Python by [[Flora Canou]] as part of the [https://github.com/FloraCanou/temperament_evaluator Temperament Evaluator] since v1.21.0. Below is an adaptation. It requires [https://numpy.org/ NumPy] and [https://www.sympy.org/en/index.html SymPy]. | |||
<syntaxhighlight lang="python"> | |||
import itertools, math | |||
import numpy as np | |||
from sympy.matrices import Matrix, normalforms | |||
def wedgie2breeds (wedgie): | |||
""" | |||
Takes a wedgie, returns the corresponding mapping if decomposable, | |||
or None otherwise. Gene Ward Smith's algorithm. | |||
""" | |||
def inversion_count (a): | |||
""" | |||
Returns the number of inversions in an array, | |||
which equals the number of swaps required to sort it. | |||
https://stackoverflow.com/a/20990301 | |||
""" | |||
length = len (a) | |||
count = 0 | |||
for i in range (length - 1): | |||
for j in range (i + 1, length): | |||
if a[i] > a[j]: | |||
count += 1 | |||
return count | |||
def hnf (a): | |||
"""Normalizes a matrix row-style to the Hermite normal form. """ | |||
return np.flip (np.array ( | |||
normalforms.hermite_normal_form (Matrix (np.flip (a).T)).T, dtype = int)) | |||
# check contorsion | |||
if np.gcd.reduce (wedgie.flat) != 1: | |||
return None | |||
# find the rank r and dimensionality d | |||
r = wedgie.ndim | |||
length = len (wedgie.flat) | |||
for d in itertools.count (start = r): | |||
length_current = math.comb (d, r) | |||
if length_current == length: | |||
break | |||
elif length_current > length: | |||
raise ValueError ("invalid length for the rank. ") | |||
# gene's b and c, converted to tuples | |||
# so that they will reset themselves on the beginning of each loop | |||
combinations = tuple (itertools.combinations (range (d), r)) | |||
subcombinations = tuple (itertools.combinations (range (d), r - 1)) | |||
# main algorithm | |||
breeds = np.zeros ((len (subcombinations), d), dtype = int) | |||
for i, si in enumerate (subcombinations): | |||
for j in range (d): | |||
if j in si: | |||
continue | |||
appended_index = (*si, j) | |||
sign = 1 if inversion_count (appended_index) % 2 == 0 else -1 | |||
k = combinations.index (tuple (sorted (appended_index))) | |||
breeds[i][j] = sign*wedgie.flat[k] | |||
breeds = hnf (breeds) | |||
return breeds if breeds.shape == (r, d) else None | |||
</syntaxhighlight> | |||
== Derivation from edo joins == | == Derivation from edo joins == | ||
| Line 105: | Line 175: | ||
Two [[vals]] can be combined into a wedgie representing the rank-2 temperament they both support using the wedge product. For example, wedging {{val| 5 8 12 }} and {{val| 7 11 16 }} (the patent vals for 5edo and 7edo) yields {{multival| (5×11 - 8×7) (5×16 - 12×7) (8×16 - 12×11) }}, which simplifies to {{multival| (55 - 56) (80 - 84) (128 - 132) }} and thus to {{multival| -1 -4 -4 }}. Note that we generally assume the first entry of the wedgie should be positive, for which we flip all the signs of it to obtain {{multival| 1 4 4 }}, which is the wedgie for 5 & 7, a.k.a. meantone. | Two [[vals]] can be combined into a wedgie representing the rank-2 temperament they both support using the wedge product. For example, wedging {{val| 5 8 12 }} and {{val| 7 11 16 }} (the patent vals for 5edo and 7edo) yields {{multival| (5×11 - 8×7) (5×16 - 12×7) (8×16 - 12×11) }}, which simplifies to {{multival| (55 - 56) (80 - 84) (128 - 132) }} and thus to {{multival| -1 -4 -4 }}. Note that we generally assume the first entry of the wedgie should be positive, for which we flip all the signs of it to obtain {{multival| 1 4 4 }}, which is the wedgie for 5 & 7, a.k.a. meantone. | ||
More than two vals can be combined into a higher-rank wedgie by an analogous method. | More than two vals can be combined into a higher-rank wedgie by an analogous method. This involves, in this case of converting multiples vals into only one comma, taking the maximal minors (determinants of a rectangular matrix's square subsets) of the collection and accounting for the prime that is not included in the subgroup (one-column-one-prime, as given). For example, the 7-limit wedgie for 5 & 6 & 7, {{multival|-2 1 0 -8}}, tempers out [[256/245]], the bapbo comma. | ||
== See also == | == See also == | ||
* [[Wedgie/Archived version]] | * [[Wedgie/Archived version]] | ||
* [[Dave Keenan & Douglas Blumeyer's guide to EA for RTT]] | |||
* [[Catalog of temperaments by wedgie]] | * [[Catalog of temperaments by wedgie]] | ||
* [[Ploidacot]] | * [[Ploidacot]] | ||