# Wedgies and multivals

The wedgie is a way of defining and working with an abstract regular temperament (that is, a regular temperament where no tuning has been decided on). Wedgies are in a one-to-one relationship with abstract regular temperaments.

In geometric terms, given monzos u and v, a rank-2 temperament's wedgie W is defined by the property that the number W(u, v) is (proportional to) the signed area of the parallelogram spanned by (tempered versions of) u and v. This is the determinant of the tempered versions of u and v. The musical interpretation of the parallelogram spanned by u and v is: If you want to consider intervals that are multiples of u apart the same note (for example, if you want an octave-equivalent scale), W(u, v) tells you how many generators of your rank-2 temperament it would take to get to v. The reason that wedgies work as unique identifiers of temperaments is that the value W(u, v) only depends on what the temperament does to u and v, and this dependence (in a sense) matches up exactly with what commas are tempered out by the temperament.

A wedgie is written as a list of entries that give the values of the wedgie on the basis elements of the JI subgroup that the temperament is on. By the alternating property [i.e. W(u, v) = −W(v, u)] and bilinearity [W is linear in each argument separately], specifying the values on basis elements of the JI subgroup is enough to define W as an alternating bilinear form on all of the JI subgroup. The simplest example is rank-2 wedgies: Let a and b be (non-contorted) vals on a JI subgroup q1.[…].qn (where the qi need not be prime). Then the entries of the wedgie W corresponding to the rank-2 temperament a&b of the JI subgroup q1.[…].qn are (ignoring sign and normalization):

$\mathrm{W}(\mathbf{q}_i, \mathbf{q}_j) = \mathrm{a}(\mathbf{q}_i)\mathrm{b}(\mathbf{q}_j) - \mathrm{a}(\mathbf{q}_j)\mathrm{b}(\mathbf{q}_i) \text{ for } i \lt j,$

where bolded variables and numbers represent the ordinary numbers written in monzo form.

(Note that by the alternating property, W(qi, qi) = 0 for all i.)

For the pn-prime limit, the entries of W are conventionally listed in the order

$\langle\langle \mathrm{W}(\mathbf{2}, \mathbf{3}) \ \ldots \ \mathrm{W}(\mathbf{2}, \mathbf{p}_n) \ \mathrm{W}(\mathbf{3}, \mathbf{5}) \ldots \ \mathrm{W}(\mathbf{3}, \mathbf{p}_n) \ldots \mathrm{W}(\mathbf{p}_{n-2}, \mathbf{p}_{n-1}) \ \mathrm{W}(\mathbf{p}_{n-2}, \mathbf{p}_n)\ \mathrm{W}(\mathbf{p}_{n-1}, \mathbf{p}_n)]].$

For example, a 5-limit wedgie is of the form

$\langle \langle \mathrm{W}(\mathbf{2}, \mathbf{3}) \ \mathrm{W}(\mathbf{2},\mathbf{5}) \ \mathrm{W}(\mathbf{3}, \mathbf{5})]],$

and a 7-limit wedgie is of the form

$\langle \langle \mathrm{W}(\mathbf{2}, \mathbf{3}) \ \mathrm{W}(\mathbf{2},\mathbf{5}) \ \mathrm{W}(\mathbf{2}, \mathbf{7}) \ \mathrm{W}(\mathbf{3}, \mathbf{5}) \ \mathrm{W}(\mathbf{3}, \mathbf{7}) \ \mathrm{W}(\mathbf{5}, \mathbf{7})]].$

More generally, if one takes r independent vals V1, …, Vr in a rank-n JI subgroup q1.[…].qn, then the wedgie for the rank-r temperament V1&…&Vr is defined by:

1. Take the wedge product of the vals, producing an r-multival.
2. Divide out the greatest common divisior of the entries.
3. If the first non-zero entry of the result of step 2 is negative, every entry of the multival is multiplied by −1, changing the sign of the first non-zero entry to be positive.

The result is the wedgie of the rank-r temperament V1&…&Vr, whose entries are (ignoring steps 2 and 3):

$\mathrm{W}(\mathbf{q}_{k_1}, \ldots, \mathbf{q}_{k_r}) = \det[\mathrm{V}_i(\mathbf{q}_{k_j})]_{i,j}, \ \text{for} \ 1 \lt k_j \lt n,$

where $[\mathrm{V}_i(\mathbf{q}_{k_j})]_{i,j}$ denotes the r×r matrix whose (i, j) entry is $\mathrm{V}_i(\mathbf{q}_{k_j})$. These are r-dimensional quantities, the volumes of the r-dimensional parallelograms spanned by qk1, ..., qkr in the temperament's lattice.

## How the period and generator falls out of a rank-2 wedgie

The following is a procedure for finding a period and a generator for a rank-2 regular temperament on the 2.q1.(…).qn JI subgroup. We also give a (hopefully convincing and enlightening) proof of why the procedure always works. We'll assume that the equave is the octave, but non-octave JI equaves can be substituted for the octave if needed, by substituting the appropriate JI ratio for 2/1.

The following assumes that:

• you can think of JI ratios as vectors living in the n-dimensional lattice of the "JI subgroup"
• you know what a "period" and a "generator" of a rank-2 temperament are
• you know what a val is and how to work with one.

### The procedure

Consider the rank-2 temperament a&b, where a and b are two vals. Then the entries of the wedgie W corresponding to a&b are W(2, q1), …, W(2, qn), and W(qi, qj) for i < j, and the entry W(p, q) is given by a(p)b(q) − a(q)b(p).

To find the period: Let d = gcd(W(2, q1), …, W(2, qn)). Then your period is 1\d.

To find (a JI interpretation of) the generator: Solve the equation W(2, g) = c1W(2, q1) + … cnW(2, qn) = d for the coefficients c1, ..., cn (using some algorithm such as the extended Euclidean algorithm). Then one valid generator for the temperament is g = (the tempered version of) q1c1qncn (written additively, a linear combination g = c1q1 + … + cnqn).

Now choosing an optimal tuning for the temperament is a matter of choosing a way to measure error from JI and minimizing the error. For example, the TE and POTE tunings are based on minimizing TE error, and those tunings can be found using the x31eq temperament finder.

### Example

Consider the wedgie W = ⟨⟨1 4 4]] for 2.3.5 meantone (the 12&19 temperament). We have W(2, 3) = 1 and W(2, 5) = 4, so d = 1, and our period is 1\1. Further, we have that 1*W(2, 3) + 0*W(2, 5) = 1, so c1 = 1, c2 = 0 is one solution, and we can use 3150 = 3/1 as our generator.

Note that -3*W(2, 3) + 1*W(2, 5) = −3*1 + 1*4 = 1, so c1 = −3, c2 = 1 is another solution to the equation. Thus 5/27 is also a valid generator. This octave reduces to the 40/27 grave fifth, which is equated to 3/2 in meantone.

### Proof (a bit technical)

The following additionally assumes that you know what the words "basis", "linear map", and "determinant" mean.

Consider the 2.q1.(…).qn JI subgroup, with basis 2, q1, ..., qn.

The period p (fraction of octave) and generator g form a basis for all the intervals of a rank-2 temperament. For example, p = 2/1 and g = 3/2 form a basis for meantone. But from a purely linear-algebra perspective, there's nothing special about the basis {p, g}; I could have chosen another basis, for example p' = 3/1 for my "period" and g' = 2/1 for my "generator". What makes the wedgie a unique identifier for a temperament is that rather than specify a basis directly, the wedgie specifies a constraint that any basis for the temperament must satisfy: namely, that a basis e1, e2 must satisfy W(e1, e2) = ±1.

In the language of linear algebra, the wedgie is an "alternating bilinear form" on the appropriate JI group M; this means that (ignoring sign) it acts like the operation of finding the determinant of two vectors on the appropriate quotient group M' = M/K of M, where K is the kernel of the bilinear form W. Using the fact that W = a&b where a and b are two edos (properly, rank-1 vals), you can verify that K is exactly the kernel of the rank-2 temperament, as follows. (Hence M/K' is a rank-2 lattice on which W is an alternating non-degenerate bilinear form, which justifies the intuition of viewing W as a determinant-like function.)

Let K1 = the kernel of the temperament (i.e. the set of commas tempered out by the temperament), and K2 = ker W = {vM : W(v, w) = 0 ∀wM}. If vK1, then v is tempered out by both a and b, so W(v, w) = a(v)b(w) − a(w)b(v) = 0, and vK2. Conversely, if vK2, then W(v, w) = a(v)b(w) − a(w)b(v) = 0 for all w, which implies a(v)b(w) = a(w)b(v) (*) for all w. Since a and b both have rank 1 but a&b has rank 2, a and b are linearly independent as vals; so we can choose w such that a(w) = 0 but b(w) ≠ 0. Then (*) shows a(v) = 0. By the same argument, b(v) = 0. So v is in K1 and K1 = K2; the kernel of the temperament is exactly the intervals that the wedgie "treats as zero".

By the First Isomorphism Theorem it follows that M' is the group of intervals in the rank-2 temperament in question.

The key fact about the determinant we use here is that two integer vectors v1, v2 form a basis for the rank-2 integer lattice Z2 iff det(v1, v2) = ±1. So in order to find a period and generator for our temperament, we need a pair of vectors {p, g} such that W(p, g) = 1 and p is 1\d for some integer d.

Let d = gcd(W(2, q1), ..., W(2, qn)). This tells you that for any JI ratio v in your JI subgroup, W(2, v) = 2N(v) for some number N(v) [that depends linearly on v]. This equation is also true when we replace 2/1 with any JI ratio u that is equated to 2/1. This tells us that for W(p, g) = 1, we (up to some choices) need p to be a JI ratio such that dp is equated to 2/1, i.e. p represents 1/d of the octave.

Choose a basis e1, e2 for the temperament group and write (the image of) 2/1 as 2/1 = λ1e1 + λ2e2. Then:

• W(2, e1) = W(λ2e2, e1) = −λ2W(e1, e2) = −λ2
• W(2, e2) = W(λ1e1, e2) = λ1W(e1, e2) = λ1.

Divisibility by d and the fact that e1 and e2 represent JI ratios in the 2.q1.[...].qn subgroup imply that λ1 and λ2 are both divisible by d, and hence 2/1 is a dth power in M' (the temperament space). Since gcd(W(2, q1), ..., W(2, qn)) = d, we can always find a linear combination g = c1q1 + ... + cnqn such that W(2, g) = c1W(2, q1) + ... + cnW(2, qn) = d using the extended Euclidean algorithm. Then since W(2, g) = W(dp, g) = dW(p, g) = d, we have W(p, g) = 1. Ta-da!

## Gene Ward Smith's introduction

An alternating multilinear map which is a multilinear function taking a certain number n of monzos as arguments and returning an integer as a value we may call an n-map. This definition is quite a mouthful, and we will attempt to unpack it in more comprehensible language and explain why these things are valuable in tuning theory.

The simplest kind of n-map is the 1-map, or val. This takes p-limit rational numbers, which may be written as monzos, and returns an integer, and may be called both a group homomorphism and a module homomorphism. Vals are linear: if you take the product of two p-limit rationals (or equivalently, add the corresponding monzos) then the val applied to the product/sum is the sum of the val applied to each separately, and so forth. Next come the 2-maps. These are linear functions f(u,v), linear for u fixing v, and linear for v fixing u, and alternating. meaning that f(u,u)=0 and f(u,v)=-f(v,u).

One use for such things is as "machines" for measuring complexity. If we consider the 1-map which is the val for 11-limit 31et, we find we have <31 49 72 87 107|. This tells us that it takes 72 steps of 31 equal to get to the approximate 5, which therefore has a complexity of 72 in this system. Now consider a 2-map "meantone(u,v)" which tells us, roughly speaking, how many generator steps it takes to get to v assuming u is being used as a period in septimal meantone. Using 2 as a period we can take (the approximate) 3/2 as a generator, in which case we have meantone(2,3)=1, meantone(2,5)=4, meantone(2,7)=10. With 3 as a period and 3/2 as a generator, we get meantone(3,5)=4 and meantone(3,7)=13. Finally, with if we take 5 as a period we find that four 3/2s give 5, so 5^(1/4) or equivalently 3/2 is the basic period. Using 3/2 as a period and 9/8 as a generator we get three generator steps to 7, and multiplying by four to be using 5 and not 5^(1/4) gives us meantone(5,7)=12. This description does not make clear where the signs come from, which will emerge from the discussion of the wedge product, but it may help to elucidate how these things are connected to complexity.

Given an n-map f and an m-map g we may define a new (n+m)-map, the wedge product of f and g, written f∧g, as follows:

$\displaystyle f\wedge g = \sum_s sgn(s)f(x_s(1),x_s(2),...,x_s(n))g(x_s(n+1),...,x_s(n+m))$

where the sum is taken over S(n,m), the set of all permutations of the first n+m integers which are an (n,m) shuffles, and sgn(t) is the parity of the permutation t, which is +1 if t is even meaning an even number of transpositions of two numbers will get to t, and -1 if t is odd.

If f and g are both vals (1-maps) then this becomes especially easy: f∧g(u,v) = f(u)g(v) - f(v)g(u). Let's consider a specific example. Suppose E19 = 19 30 44 53] is the equal temperament val for septimal 19et, and E31 = 31 49 72 87] is the val for septimal 31et. Then writing intervals multiplicatively, we have

$(E19\wedge E31)(2,3) = E19(2)E31(3) - E19(3)E31(2) = 19*49 - 31*30 = 1$

We may continue in this way to consider (2,5), (2,7), (3,5), (3,7) and (5,7), and writing them in this alphabetical order yields <<1 4 10 4 13 12||. Here the double angle braces are to indicate that the object is a 2-map. In fact, it is a special kind of 2-map in that it is the result of taking a wedge product rather than being, eg, the sum of two wedge products and is called a bival. In the same way, triple wedge products yield trivals which we depict with three angle braces, and so forth. Just as vals as associatd to rank one (equal) temperaments, bivals are associated to rank two temperaments such as meantone, trivals to rank three temperaments, and so forth. In tuning theory the necessity to look at any n-maps aside from vals, bivals and trivals seldom arises, so this notation, which is not standardly mathematical but which has been adopted for convenience by tuning theorists, is quite practical. As we can see by comparing the numbers, E19∧E31 is the same object we were calling "meantone(u,v)" which gives us complexity measurements for meantone.

This particular bival has the properties that the first nonzero coordinate (1, in this case) is positive, and that the GCD of all of the coordinates is 1. An n-map with these properties we may call reduced, and reduced n-vals can be used to give unique names to regular temperaments.

These reduced n-vals, and particularly reduced bivals, are called wedgies, and the fact that they are reduced both makes the name unique and tells us that wedgies are projective, and hence the definition of regular temperaments in terms of them is projective. Thus, E24 = <24 38 56| is a perfectly valid val, but since it is not reduced, it does not define a 1-wedgie and hence there is no 5-limit 24et temperament to go with it. Sometimes such a temperament, where more than one set of notes exists in it each of which is unreachable from the others via intervals with defined prime mappings is called contorted. Wedgies do not name or signify contorted temperaments.

## Truncation of wedgies

A useful operation to perform on any multivector, including wedgies, is truncation of the wedgie to a lower prime limit. This in effect sets all the basis vectors of a p-limit wedgie which are greater than q, the prime limit being truncated to, to zero. An algorithm to produce the truncation is to list the r-subsets of the primes to p in alphabetical order, and add the corresponding coefficient to the list of the q-limit truncation if and only if the maximum prime in the r-subet is less than or equal to q. Truncating a wedgie can lead to a non-wedgie if the GCD of the coefficients is greater than one; this means that in the lower limit, contortion has appeared.

## Conditions on being a wedgie

If we take any three integers <<a b c|| such that GCD(a, b, c) = 1 and a ≥ 1 the result is always a wedgie, the wedgie tempering out the dual monzo |c -b a>. Since three such integers chosen at random are unlikely to produce a suitably small comma, the temperament will probably not be worth much, but at least it can be defined.

However, this is no longer the case in higher limits. There, not everything which looks like a wedgie will be one; for instance the wedgies must also satisfy the condition, for any wedgie W, that W∧W = 0, where the "0" means the multival of rank 2r obtained by wedging W with W. For prime limits 7 and 11 this condition suffices for rank two, but in general we need to check, for every prime q ≤ p and every basis val v sending q to 1 and everything else to 0, that (W∨q)∧W and (W∧v)º∧Wº = 0, where "∨" denotes the interior product. These conditions, the complete set along with the basic reduction conditions for being a wedgie, are known as the Plücker relations. Note that the Plücker relations must be satisfied, since for a rank r multival, W∨q is a rank r-1 multival corresponding to tempering out all the commas of W, as well as q.

In the 7-limit case, if we wedge a prospective rank two multival W = <<a b c d e f|| with itself, we obtain W∧W = 2(af-be+cd). The quantity af-be+cd is the Pfaffian of the wedgie, and that the Pfaffian is zero tells us that in the five-dimensional projective space P⁵ in which wedgies live, the wedgie lies on a (four-dimensional) hypersurface, known as the Grassmannian Gr(2, 4). For an 11-limit rank-two wedgie W = <<w1 w2 w3 w4 w5 w6 w7 w8 w9 w10|| we have that W∧W = 2<<<<w1w8-w2w6+w3w5, w1w9-w2w7+w4w5, w1w10-w3w7+w4w6, w2w10-w3w9+w4w8, w5w10-w6w9+w7w8|||| is zero. These conditions allow us to solve for three of the coefficients in terms of the other seven, and so that Gr(2, 5), the Grassmannian of rank-two 11-limit temperaments, is a six-dimensional projective algebraic variety in nine-dimensional projective space P⁹. Wedgies correspond to rational points on this variety. For 11-limit rank three temperaments, we have w6w1-w5w2+w4w3 = w9w1-w8w2+w7w3 = w10w1-w8w4+w7w5 = w10w2-w9w4+w7w6 = w10w3-w9w5+w8w6 = 0; again, this leads to a six-dimensional variety, this time Gr(3, 5).

## Constrained wedgies

Most of the wedgies which are legitimate according to the previous section do not represent temperaments which are in any way reasonable. To get temperaments which are, we need to constrain the relevant metrics--complexity should not be too high, error should not be too high, and badness should not be so high that competing temperaments are much better. Let us consider how bounding relative error E, aka simple badness, constrains a 7-limit rank two wedgie W = <<a b c d e f||.

By definition, E = ||J∧Z||, where Z is the weighted version of W; if q3, q5 and q7 are the logarithms base two of 3, 5, and 7, then Z = <<a/q3 b/q5 c/q7 d/(q3q5) e/(q3q7) f/(q5q7)||. We now have

$\displaystyle (\frac{d}{q_3q_5}-\frac{b}{q_5}+\frac{a}{q_3})^2+(\frac{e}{q_3q_7}-\frac{c}{q_7}+\frac{a}{q_3})^2+(\frac{f}{q_5q_7}-\frac{c}{q_7}+\frac{b}{q_5})^2 \\ +(\frac{f}{q_5q_7}-\frac{e}{q_3q_7}+\frac{d}{q_3q_5})^2 = 4 E^2$

From this we can conclude that d, e and f satisfy |d - q3b + q5a| ≤ 2Eq3q5, |e - q3c + q7a| ≤ 2Eq3q7 and |f - q5c + q7d| ≤ 2Eq5q7. This has an interesting interpretation: since <1 q3 q5 q7|∧<0 a b c| = <<a b c q3b-q5a q3c-q7a q5c-q7b||, if E ≤ 1/(4q5q7), then the full wedgie can be recovered from the octave equivalent (OE) portion of the wedgie simply by wedging it with <1 q3 q5 q7| and rounding to the nearest integer. This is not a very serious constraint to place on relative error; it seems unlikely anyone would be interested in a temperament which did not fall well under this low standard. Hence we may compile lists of reasonable temperaments by presuming "reasonable" requires this bound to be met, searching through triples <<a b c ...|| (note that if all of these are zero, 2 is being tempered out) up to some complexity bound, wedging with <1 q3 q5 q7| and rounding, then checking if the GCD is one and the Pfaffian af-be+cd is zero. Then we may toss everthing which does not meet the bound on relative error; however, for a reasonable list we will want a tighter bound.

If C = ||W|| is the TE complexity, then the formula for the logflat badness B in the 7-limit rank-two case is particularly simple: B = CE. If complexity is bounded by, for example, 20 (which allows for some quite complex temperaments) then since E ≤ 1/(4q5q7), B ≤ 20/(4q5q7) = 0.767. This badness figure is easily met. While simply bounding complexity will lead to a finite list, the list would be enormous. An alternative is also to bound badness; for instance, we might produce a list of 7-limit rank-two temperaments with complexity less than 20 and a more reasonable badness limit, such as 0.05 or 0.06.

## Reconstituting wedgies in general

Essentially the same situation obtains for rank two temperaments in higher limits. The rule then is that if E ≤ 1/(C(n, 3)lb(q)lb(p)) then wedging K = <1 lb(3) lb(5) ... lb(p)| with the val consisting of 0 followed by the first n-1 coefficients of the wedgie and rounding will give the wedgie. Here p and q are the largest and second largest primes in the prime limit, lb(x) is log base two, and C(n, 3) is n choose three, n(n-1)(n-2)/6.

More generally, we can reconstitute W by rounding Y = (W∨2)∧K to the nearest integer coefficients, where K is the JI point <1 lb(3) lb(5) ... lb(p)| in unweighted coordinates. Then we have ||(W-Y)+Y|| ≤ ||W-Y|| + ||Y|| by the triangle inequality, and since ||W-Y|| is bounded by the fact that W has been obtained by rounding, complexity, which is ||(W-Y)+Y||=||W||, can be bounded by ||Y||; which means it can be bounded by the coefficients of Y, which are those coefficients of W which can be found in W∨2 and over which we could be conducting a search. Moreover, we have from Y∧K = ((W∨2)∧K)∧K = 0 that relative error, which is ||W∧K||, is ||((W-Y) + Y)∧K||=||(W-Y)∧K||, hence relative error is also bounded by the fact that ||W-Y|| is bounded. This means that unless relative error is large, W can be recovered by rounding Y, and hence all wedgies within such a bound, which we may call recoverable, can be found by a search on only some prospective coefficients. Temperaments which are not recoverable seem of little interest and may be ruled out of consideration. Search spaces for complexity measures such as TE complexity which are defined in terms of the wedgie can be obtained by assuming all wedgie coefficients which are not being used to recover a wedgie are zero, which gives a minimum value for the complexity. In the case of rank two temperaments, an especially efficient complexity measure for such searches, and one with some other desirable properties, is generator complexity.

In the particular case of the 11-limit in rank three, we have that (W∨2)∧K gives the full wedgie, which has ten coefficents, in terms of the first six upon rounding off. Using this for a search is less difficult than it sounds, since the complexity numbers for rank three are so much lower. If the relative error E satisifes E ≤ 1/(2√5 q5q7q11), then the rounding off is guaranteed to lead to the correct result. This amount, 0.0099, is again easily met.