# 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 *k* linearly independent vals of dimension *n*, they will span a subspace of tuning space. This subspace defines a regular temperament of rank *k* in the prime limit *p*, where *p* is the *n*-th prime. Similarly, starting from *n* - *k* independent commas for the same regular temperament, the corresponding monzos span an *n* - *k* 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.

## 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]W = \operatorname {diag} (1/\log_2 (Q))[/math]

If A is the mapping of the abstract temperament whose rows are (not necessarily independent) vals, then V = AW is the mapping in the weighted space. If J_{0} is the row vector of targeted JI intervals (i.e. the JIP), then J = J_{0}W 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]GV = J[/math]

The system simply says that the sum of *v*_{kl} steps of generator *g*_{k} for all *k'*s should equal the *l*-th targeted JI interval *j*_{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]G = JV^+[/math]

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

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

We may also obtain the TE tuning from a projection matrix. P = V^{+}V 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 JI map: JP where J is the JI map, 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 is a rank *n* matrix whose columns are weighted monzos, and I is the *n*×*n* identity matrix, then P = I - MM^{+} is the same projection matrix as V^{+}V 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

*See also: 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: CTE 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.

## 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 list of Frobenius generators, G_{F}, is given by:

[math]G_\text{F} = J_0 A^+[/math]

where J_{0} is the nonweighted JIP and A is the nonweighted mapping.

The Frobenius tuning map, T_{F}, is given by:

[math]T_\text{F} = G_\text{F} A = J_0 A^+A[/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 A is a matrix whose rows are vals, then P = A^{+}A is a positive-semidefinite symmetric matrix with rational matrix entries, which exactly specifies the regular temperament defined by the vals of A. If B 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 - BB^{+}.

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

## Examples

*For practical helps, see POTE tuning.*

The val for 5-limit 12et is ⟨12 19 28]. In weighted coordinates, that becomes v_{12} = ⟨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}^{+} ~ [[0.027706 0.027677 0.027842⟩]. Then P = v_{12}^{+}v_{12} is a projection matrix that maps onto the one-dimensional subspace whose single basis vector is v_{12}. We find that v_{12}P equals v_{12}; 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

V ~ [⟨12 11.988 12.059 12.111], ⟨22 22.083 21.965 22.085]]

Then the pseudoinverse V^{+} is approximately

[-1.81029 1.00052]

[-6.68250 3.66285]

[4.83496 -2.63063]

[3.67652 -1.99757]

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

Paj = V^{+}V 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 u_{12}^{+} of the 5-limit val u_{12} for 12 equal is the column matrix u_{12}^{T}/1289; that is, the 1×3 matrix with column [12/1289 19/1289 28/1289⟩. Then u_{12}^{+}u_{12} is the 3×3 Frobenius projection matrix F:

[⟨144 228 336], ⟨228 361 532], ⟨336 532 784]]/1289

Multiplying ⟨12 19 28] by 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 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 F, which is to say by [1 0 0⟩F, of 1196.778 cents.

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

[[36 92 14 32⟩, [92 269 -32 14⟩, [14 -32 141 148⟩, [32 14 148 64⟩]/305

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