# 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 TE-weighted basis.

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 (L1) error of any interval, TE tuning minimizes the maximum TE-weighted (L2) error of any interval.

## Introduction

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.

## TE tuning

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 log23 … log2p]. The two approaches are equivalent.

In more pragmatic terms, suppose A is the known mapping of the abstract temperament whose rows are (not necessarily independent) vals, and W the weighting matrix. In this case, Wij = 1/log2p if i = j, and 0 otherwise. Then V = AW is the mapping in the weighted basis. Let's also denote the row vector of TE generators G, the row vector of targeted JI intervals J0. TE tuning then defines a least squares problem of the following overdetermined linear equation system:

$GV = J$

where J = J0W, i.e. the JIP, in the case of Tenney-weighted tuning space it is 1 1 … 1]. The system simply says that the sum of Vij steps of generator Gi for all i should equal the j-th targeted JI interval Jj.

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

## Computing TE tuning 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
• (AT)+ = (A+)T, where AT 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+ = AT(AAT)-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

$G = JV^+$

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

$T = GV = JV^+V$

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.

## Pure-octaves TE 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/T1, where T1, 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, GF, is given by:

$G_\text{F} = J_0 A^+$

where J0 is the nonweighted JIP and A is the nonweighted mapping.

The Frobenius tuning map, TF, is given by:

$T_\text{F} = G_\text{F} A = J_0 A^+A$

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 = AT(AAT)-1A. If the columns of B are independent, then we likewise have P = I - B(BTB)-1BT.

## Examples

For practical helps, see POTE tuning.

The val for 5-limit 12et is 12 19 28]. In weighted coordinates, that becomes v12 = 12 19/log23 28/log25] ~ 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 v12+ ~ [[0.027706 0.027677 0.027842]. Then P = v12+v12 is a projection matrix that maps onto the one-dimensional subspace whose single basis vector is v12. We find that v12P equals v12; on the other hand, if we take the monzo for 81/80, which is [-4 4 -1; and monzo-weight it to [-4 4log23 -log25 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 u12+ of the 5-limit val u12 for 12 equal is the column matrix u12T/1289; that is, the 1×3 matrix with column [12/1289 19/1289 28/1289. Then u12+u12 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 (284 3133 5196)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 0F, 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.