# Tenney-Euclidean tuning

**Tenney-Euclidean tuning** (**TE tuning**), also known as **TOP-RMS tuning**, is a tuning technique for regular temperaments which leads to the least sum of squared errors of the Tenney-weighted basis.

If we have *r* linearly independent vals of dimension *n*, they will span a subspace of tuning space. This subspace defines a regular temperament of rank *r* in the prime limit *p*, where *p* is the *n*-th prime. Similarly, starting from *n* - *r* independent commas for the same regular temperament, the corresponding monzos span an *n* - *r* dimensional subspace of interval space. Both the subspace of tuning space and the subspace of interval space characterize the temperament completely. A question then arises as to how to choose a specific tuning for this temperament, which is the same as asking how to choose a point (vector) in this subspace of tuning space which provides a good tuning. One answer to this is the weighted RMS (root mean squared) tuning discussed right here.

TE tuning can be viewed as a variant of TOP tuning since it employs the TE norm in place of the Tenney height as in TOP tuning. Just as TOP tuning minimizes the maximum Tenney-weighted *L*_{1} error of any interval, TE tuning minimizes the maximum Tenney-weighted *L*_{2} error of any interval.

In D&D's guide, the systematic name for TE tuning is *minimax-ES*.

## Definition

If we put the weighted Euclidean metric on tuning space, leading to TE tuning space in weighted coordinates, it is easy to find the nearest point in the subspace to the JIP ⟨1 1 … 1], and this closest point will define a tuning map which is called TE tuning, a tuning which has been extensively studied by Graham Breed. We may also keep unweighted coordinates and use the TE norm on tuning space; in these coordinates the JI point is ⟨1 log_{2}3 … log_{2}*p*]. The two approaches are equivalent.

In more pragmatic terms, suppose W is the weighting matrix. For the prime basis Q = ⟨2 3 5 … *p*],

[math]\displaystyle W = \operatorname {diag} (1/\log_2 (Q))[/math]

If V is the mapping of the abstract temperament whose rows are (not necessarily independent) vals, then V_{W} = VW is the mapping in the weighted space. If J is the row vector of targeted JI intervals (i.e. the JIP), then J_{W} = JW is the JI intervals in the weighted space, in the case of Tenney-weighting it is ⟨1 1 … 1]. Let us also denote the row vector of TE generators G. TE tuning then defines a least squares problem of the following overdetermined linear equation system:

[math]\displaystyle GV_W = J_W[/math]

The system simply says that the sum of (*v*_{w})_{kl} steps of generator *g*_{k} for all *k'*s should equal the *l*-th targeted JI interval (*j*_{w})_{l}.

There are a number of methods to solve least squares problems. One common way is to use the Moore–Penrose pseudoinverse.

## Computation using pseudoinverse

The Moore–Penrose pseudoinverse, denoted A^{+} in this article, is a generalization of the inverse matrix with which it shares a lot of properties. To name a few:

- If A is invertible, its inverse is A
^{+} - If A has rational entries, so does A
^{+} - (A
^{+})^{+}= A - (A
^{T})^{+}= (A^{+})^{T}, where A^{T}is the transpose of A - AA
^{+}is the orthogonal projection matrix that maps onto the space spanned by the columns of A - A
^{+}A is the orthogonal projection matrix that maps onto the space spanned by the rows of A - I - A
^{+}A, where I is the identity matrix, is the orthogonal projection matrix that maps onto the kernel, or null space, of A - If the rows of A are linearly independent, then A
^{+}= A^{T}(AA^{T})^{-1}. This means the pseudoinverse can be found in this important special case by people who don't have a pseudoinverse routine available by using a matrix inverse routine. - uA
^{+}is the nearest point to u in the subspace spanned by the rows of A; A^{+}v is the nearest point to v in the space spanned by the columns of A.

In the pseudoinverse method, the (not necessarily independent) TE generators which correspond to the rows of V are given by

[math]\displaystyle G = J_W V_W^+[/math]

Applying the weighted val list to the generators, The TE tuning map is given by

[math]\displaystyle T = GV = J_W V_W^+ V[/math]

We may also obtain the TE tuning from a projection matrix. P = V_{W}^{+}V_{W} is the orthogonal projection matrix that maps onto the space spanned by the rows of V. This space corresponds to the temperament, and so does P. However, P is independent of how the temperament is defined; it does not depend on whether the vals are linearly independent, how many of them there are, or whether contorsion has been removed. The tuning map giving the tuning of each prime number is found by multiplying by the JIP: T = JP where J is the JIP, which is the nearest point in the subspace corresponding to the temperament to J.

We may find the same projection matrix starting from a list of weighted monzos rather than vals. If M_{W} is a rank-*n* matrix whose columns are weighted monzos, and I is the *n*×*n* identity matrix, then P = I - M_{W}M_{W}^{+} is the same projection matrix as V_{W}^{+}V_{W} so long as the temperament defined by the vals is the same as the temperament defined by the monzos. Again, it is irrelevant if the monzos are independent or how many of them there are.

## Enforcement

### Pure-octaves TE tuning

*Main article: POTE tuning*

We may call pure-octaves Tenney-Euclidean tuning the *POTE tuning*. If T = JP = GV is the TE tuning map, then a corresponding pure-octaves map can be found by scalar multiplication, T/T_{1}, where T_{1}, the first entry, is the tuning of 2. The justification for this is that T does not only define a point, but a line through the origin lying in the subspace defining the temperament, or in other words, a point in the linear subspace of projective space corresponding to the temperament, and hence is a projective object. Another way to say this is that T defines not only the closest point to J, but the closest direction in terms of angular measure between the line through T and the line through J.

### Constrained TE tuning

*Main article: Constrained tuning*

Another way to enforce the pure octave is by adding the constraint before the optimization process. This is the *CTE tuning*. The result, under the constraint of pure octaves, remains TE optimal.

## Otherwise normed tunings

### Frobenius tuning and Frobenius projection matrix

We may also do the same things starting from nonweighted vals. This leads to a different tuning, the **Frobenius tuning**, which is perfectly functional but has less theoretical justification than TE tuning. However, if greater weight needs to be attached to the larger primes than TE tuning attaches, Frobenius tuning may be preferred; people who feel that larger primes require more tuning care than smaller ones may well prefer it.

The weighting matrix W is given by

[math]\displaystyle W = I[/math]

That simplifies the list of Frobenius generators G to

[math]\displaystyle G = JV^+[/math]

where J is the nonweighted JIP and V is the nonweighted mapping.

The Frobenius tuning map T becomes

[math]\displaystyle T = GV = JV^+V[/math]

However, the main value of unweighted vals is that the pseudoinverse and projection matrix have rational entries, so that the rows of the matrix are fractional monzos. The Frobenius projection matrix therefore, like the wedgie, defines a completely canonical object not depending on any arbitrary definition (e.g. how Hermite normal form or LLL reduction is specifically defined) which corresponds one-to-one with temperaments, and which does not depend on whether the monzos or vals from which it is computed are saturated. It may be found starting either from a set of vals or a set of commas, since if Q is the projection matrix found by treating monzos in the same way as vals, P = I - Q is the same projection matrix as would be found if starting from a set of vals defining the same temperament.

Spelling this out, if V is a matrix whose rows are vals, then P = V^{+}V is a positive-semidefinite symmetric matrix with rational matrix entries, which exactly specifies the regular temperament defined by the vals of V. If M is a matrix with columns of monzos which spans the subspace of interval space containing the commas, then this same matrix P is given by I - MM^{+}.

If the vals defining V are linearly independent, then P = V^{T}(VV^{T})^{-1}V. If the columns of M are independent, then we likewise have P = I - M(M^{T}M)^{-1}M^{T}.

In D&D's guide, the systematic name for Frobenius tuning is *minimax-E-copfr-S*.

### Benedetti/Wilson-Euclidean tuning

**Benedetti/Wilson-Euclidean tuning** (**BE tuning**) adopts the Benedetti or Wilson weight in place of Tenney weight, based on the dual norm of Wilson height. For Q = ⟨2 3 5 …], the weighting matrix has the form

[math]\displaystyle W = \operatorname {diag} (1/Q)[/math]

In D&D's guide, the systematic name for BE tuning is *minimax-E-sopfr-S*.

## Examples

*For practical helps, see POTE tuning.*

The val for 5-limit 12et is V_{12} = ⟨12 19 28]. In weighted coordinates, that becomes (V_{12})_{W} = ⟨12 19/log_{2}3 28/log_{2}5] ~ ⟨12.0 11.988 12.059]. If we take this to be a 1×3 matrix and take the pseudoinverse, we get the 3×1 matrix (V_{12})_{W}^{+} ~ [[0.027706 0.027677 0.027842⟩]. Then P = (V_{12})_{W}^{+}(V_{12})_{W} is a projection matrix that maps onto the one-dimensional subspace whose single basis vector is (V_{12})_{W}. We find that (V_{12})_{W}P equals (V_{12})_{W}; on the other hand, if we take the monzo for 81/80, which is [-4 4 -1⟩; and monzo-weight it to [-4 4log_{2}3 -log_{2}5⟩ and multiply (either side, the matrix is symmetric) by P, we get the zero vector, corresponding to the unison.

Now consider pajara, the 7-limit temperament tempering out both 50/49 and 64/63. Two possible equal temperament tunings for pajara are 12edo and 22edo. We may define a 2×4 matrix with rows equal to the vals for 12, and 22; in weighted coordinates this would be

[math]\displaystyle V_W = \begin{bmatrix} 12.000 & 11.988 & 12.059 & 12.111 \\ 22.000 & 22.083 & 21.965 & 22.085 \end{bmatrix} [/math]

Then the pseudoinverse V^{+} is approximately

[math]\displaystyle V_W^+ = \begin{bmatrix} -1.81029 & 1.00052 \\ -6.68250 & 3.66285 \\ 4.83496 & -2.63063 \\ 3.67652 & -1.99757 \end{bmatrix} [/math]

which we may also write as [[-1.81029 -6.68250 4.83496 3.67652⟩, [1.00052 3.66285 -2.63063 -1.99757⟩]

P = V_{W}^{+}V_{W} is a 4×4 symmetrical matrix which projects weighted vals in TE tuning space, or weighted monzos in TE interval space, to a subspace defined by pajara. It therefore projects the weighted monzos for 50/49, 64/63, 225/224, 2048/2025 etc. to the zero vector, whereas it leaves pajara vals such as 10edo in weighted coordinates unchanged.

If we use unweighted coordinates we get the Frobenius projection matrix instead, whose rows are fractional monzos. The unweighted pseudoinverse V_{12}^{+} of the 5-limit val V_{12} for 12 equal is the column matrix V_{12}^{T}/1289; that is, the 1×3 matrix with column [12/1289 19/1289 28/1289⟩. Then V_{12}^{+}V_{12} is the 3×3 Frobenius projection matrix P_{F}:

[math]\displaystyle P_\text{F} = \frac{1}{1289} \begin{bmatrix} 144 & 228 & 336 \\ 228 & 361 & 532 \\ 336 & 532 & 784 \end{bmatrix} [/math]

Multiplying ⟨12 19 28] by P_{F} gives ⟨12 19 28] again. Multiplying the monzos for 81/80, 128/125, 648/625 etc. gives the zero monzo, corresponding to a unison. Multiplying the val for 5-limit 19 equal, ⟨19 30 44], by P_{F} gives ⟨24360 38570 56840]/1289, which is approximately the 19 equal val. Multiplying the 5-limit monzo for 3/2, which is [-1 1 0⟩; times F gives the fractional monzo corresponding to (2^{84} 3^{133} 5^{196})^{1/1289}, which equates to 698.121 cents, the tempering of 3/2 in Frobenius tuning for 5-limit 12et, the tuning with octave defined by the top row of P_{F}, which is to say by [1 0 0⟩P_{F}, of 1196.778 cents.

We can do the same thing with a matrix V with rows consisting of the vals for 7-limit 12 and 22 equal; then V^{+}V, the Frobenius projection matrix for pajara, is

[math]\displaystyle P_\text{F} = \frac{1}{305} \begin{bmatrix} 36 & 92 & 14 & 32 \\ 92 & 269 & -32 & 14 \\ 14 & -32 & 141 & 148 \\ 32 & 14 & 148 & 64 \end{bmatrix} [/math]

This sends monzos for 50/49, 64/63 etc. to the unison monzo, and vals for 10et, 12et and 22et to themselves.