Tenney–Euclidean temperament measures: Difference between revisions

*Dirichlet coeffcients* was meant to be a generic substitute for logflat badness
Document my implementation of Sintel's error. Request proof for logflat badness. - editorial notes
 
(7 intermediate revisions by 4 users not shown)
Line 5: Line 5:


== Preliminaries ==
== Preliminaries ==
There have been several minor variations in the definition of TE temperament measures, which differ from each other only in their choice of multiplicative scaling factor. The reason these differences come up is because we are adopting different averaging methods for the entries of a multivector.
There have been several minor variations in the definition of TE temperament measures, which differ from each other only in their choice of multiplicative scaling factor. These differences come up because we are adopting different averaging methods for the entries of a multivector. To start with, consider a norm defined by means of the usual {{w|norm (mathematics) #Euclidean norm|Euclidean norm}}, a.k.a. ''L''<sup>2</sup> or ℓ<sub>2</sub> norm. The result of this is a kind of a sum of all the entries. We can rescale this in several ways, for example by taking a {{w|root mean square}} (RMS) average of the entries, by normalizing for the temperament's rank, and/or by normalizing up to the norm of the [[just tuning map]].  


To start with, we may define a norm by means of the usual {{w|norm (mathematics) #Euclidean norm|Euclidean norm}}, a.k.a. ''L''<sup>2</sup> norm or ℓ<sub>2</sub> norm. The result of this is a kind of a sum of all the entries. We can rescale this in several ways, for example by taking a {{w|root mean square}} (RMS) average of the entries.  
''These metrics are meant to be used to rank temperaments within the same [[rank]] and [[subgroup]]''. It does not matter much which scheme is used, because they will rank temperaments identically. As a result, it is somewhat common to equivocate between the various choices of scaling factor, and treat the entire thing as "the" Tenney–Euclidean norm, so that we are really only concerned with the results of these metrics up to that equivalence.  


Here are the different standards for scaling that are commonly in use:
[[Graham Breed]]'s original definitions<ref name="primerr">Graham Breed. [http://x31eq.com/temper/primerr.pdf ''Prime Based Error and Complexity Measures''], often referred to as ''primerr.pdf''.</ref> are based on an RMS norm normalized for the temperament's rank, as are parts of his [https://x31eq.com/temper/ Temperament Finder], although other scaling and normalization methods are sometimes used as well.
# Taking the simple ''L''<sup>2</sup> norm
# Taking an RMS
# Taking an RMS and also normalizing for the temperament rank
# Any of the above and also dividing by the norm of the just intonation points ([[JIP]]).  


As these metrics are mainly used to rank temperaments within the same [[rank]] and [[just intonation subgroup]], it does not matter much which scheme is used, because they are equivalent up to a scaling factor, so they will rank temperaments identically. As a result, it is somewhat common to equivocate between the various choices of scaling factor, and treat the entire thing as "the" Tenney–Euclidean norm, so that we are really only concerned with the results of these metrics up to that equivalence.
More recently, it is proposed that the metrics should be normalized to allow us to meaningfully compare temperaments across subgroups and even ranks. [[Sintel]]'s scheme in 2023 is the first attempt at this goal<ref name="sintel">Sintel. [https://github.com/Sin-tel/temper/blob/c0d5c36e3c189f64860f4aea288ff3ff3bc34982/lib_temper/temper.py "Collection of functions for dealing with regular temperaments"], Temperament Calculator.</ref>, though still with notable caveats.  


Graham Breed's original definitions from his ''primerr.pdf'' paper tend to use the third definition, as do parts of his [https://x31eq.com/temper/ temperament finder], although other scaling and normalization methods are sometimes used as well.
Each of these will be discussed in detail below.
 
It is also possible to normalize the metrics to allow us to meaningfully compare temperaments across subgroups and even ranks. [[Sintel]]'s scheme in 2023 is the first attempt at this goal<ref name="sintel">Sintel. [https://github.com/Sin-tel/temper/blob/c0d5c36e3c189f64860f4aea288ff3ff3bc34982/lib_temper/temper.py "Collection of functions for dealing with regular temperaments"], Temperament Calculator.</ref>.  


== TE complexity ==
== TE complexity ==
Given a [[wedgie]] ''M'', that is a canonically reduced ''r''-val correspondng to a temperament of rank ''r'', the norm ‖''M''is a measure of the complexity of ''M''; that is, how many notes in some sort of weighted average it takes to get to intervals. For 1-vals, for instance, it is approximately equal to the number of scale steps it takes to reach an octave.  
TE complexity is the average hypervolume of the parallelepipeds formed by any ''n'' linearly independent generators which form and saturate that lattice. Since this is exactly the same thing as the magnitude of the multivector formed by those vectors, TE complexity is the exact same thing as the average of the coefficients of the [[wedgie]] for that temperament.


Let us define the val weighting matrix ''W'' to be the {{w|diagonal matrix}} with values 1, 1/log<sub>2</sub>3, 1/log<sub>2</sub>5 … 1/log<sub>2</sub>''p'' along the diagonal. For the prime basis {{nowrap|''Q'' {{=}} {{val| 2 3 5 … ''p'' }} }},  
Let us define the val weighting matrix ''W'' to be the {{w|diagonal matrix}} with values 1, 1/log<sub>2</sub>3, 1/log<sub>2</sub>5 … 1/log<sub>2</sub>''p'' along the diagonal. For the prime basis {{nowrap|''Q'' {{=}} {{val| 2 3 5 … ''p'' }} }},  
Line 29: Line 23:


If ''V'' is the mapping matrix of a temperament, then ''V<sub>W</sub>'' {{=}} ''VW'' is the mapping matrix in the weighted space, its rows being the weighted vals (''v''<sub>''w''</sub>)<sub>''i''</sub>.  
If ''V'' is the mapping matrix of a temperament, then ''V<sub>W</sub>'' {{=}} ''VW'' is the mapping matrix in the weighted space, its rows being the weighted vals (''v''<sub>''w''</sub>)<sub>''i''</sub>.  
Given a wedgie ''M'', that is a canonically reduced ''r''-val correspondng to a temperament of rank ''r'', the norm ‖''M''‖ is a measure of the complexity of ''M''; that is, how many notes in some sort of weighted average it takes to get to intervals. For 1-vals, for instance, it is approximately equal to the number of scale steps it takes to reach an octave.


Our first complexity measure of a temperament is given by the ''L''<sup>2</sup> norm of the Tenney-weighted wedgie ''M''<sub>''W''</sub>, which can in turn be obtained from the Tenney-weighted mapping matrix ''V''<sub>''W''</sub>. This complexity can be easily computed either from the wedgie or from the mapping matrix, using the {{w|Gramian matrix|Gramian}}:  
Our first complexity measure of a temperament is given by the ''L''<sup>2</sup> norm of the Tenney-weighted wedgie ''M''<sub>''W''</sub>, which can in turn be obtained from the Tenney-weighted mapping matrix ''V''<sub>''W''</sub>. This complexity can be easily computed either from the wedgie or from the mapping matrix, using the {{w|Gramian matrix|Gramian}}:  
Line 36: Line 32:
where det(·) denotes the determinant, and {{t}} denotes the transpose.  
where det(·) denotes the determinant, and {{t}} denotes the transpose.  


Graham Breed and [[Gene Ward Smith]] have proposed different RMS norms. Let us denote the RMS norm of ''M'' as ‖''M''‖<sub>RMS</sub>. In Graham's paper<ref name="primerr">Graham Breed. [http://x31eq.com/temper/primerr.pdf ''Prime Based Error and Complexity Measures''], often referred to as ''primerr.pdf''.</ref>, an RMS norm is proposed as
Graham Breed and [[Gene Ward Smith]] have proposed different RMS norms. Let us denote the RMS norm of ''M'' as ‖''M''‖<sub>RMS</sub>. In Graham's paper<ref name="primerr"/>, an RMS norm is proposed as


$$ \norm{M_W}_\text{RMS} = \sqrt {\det \left( \frac {V_W V_W^\mathsf{T}}{n} \right)} = \frac {\norm{M_W}_2}{\sqrt {n^r}} $$
$$ \norm{M_W}_\text{RMS} = \sqrt {\det \left( \frac {V_W V_W^\mathsf{T}}{n} \right)} = \frac {\norm{M_W}_2}{\sqrt {n^r}} $$


where ''n'' is the number of primes up to the prime limit ''p'', and ''r'' is the rank of the temperament. Thus ''n''<sup>''r''</sup> is the number of permutations of ''n'' things taken ''r'' at a time with repetition, which equals the number of entries of the wedgie in its full tensor form.  
where ''n'' is the number of primes up to the prime limit ''p'', and ''r'' is the rank of the temperament. Thus ''n''<sup>''r''</sup> is the number of permutations of ''n'' things taken ''r'' at a time with repetition, which equals the number of entries of the wedgie in its full tensor form. That is the definition used by Graham Breed's Temperament Finder.  
 
: '''Note''': that is the definition used by Graham Breed's temperament finder.  


Gene Ward Smith's RMS norm is given as
Gene Ward Smith's RMS norm is given as
Line 84: Line 78:
$$
$$


: '''Note''': that is the definition used by Graham Breed's temperament finder.  
And that is the definition used by Graham Breed's Temperament Finder.  


Gene Ward Smith defines the TE error as the ratio ‖''M''<sub>''W''</sub> ∧ ''J''<sub>''W''</sub>‖/‖''M''<sub>''W''</sub>‖, derived from the relationship of TE simple badness and TE complexity. See the next section. We denote this definition of TE error ''Ψ''. From {{nowrap|‖''M''<sub>''W''</sub> ∧ ''J''<sub>''W''</sub>‖/‖''M''<sub>''W''</sub>‖}} we can extract a coefficient {{nowrap| sqrt(''C''(''n'', ''r'' + 1)/''C''(''n'', ''r'')) {{=}} sqrt((''n'' − ''r'')/(''r'' + 1)) }}, which relates ''Ψ'' with ''E'' as follows:  
Gene Ward Smith defines the TE error as the ratio {{nowrap|‖''M''<sub>''W''</sub> ∧ ''J''<sub>''W''</sub>‖/‖''M''<sub>''W''</sub>‖}}, derived from the relationship of TE simple badness and TE complexity. See the next section. We denote this definition of TE error ''Ψ''. From {{nowrap|‖''M''<sub>''W''</sub> ∧ ''J''<sub>''W''</sub>‖/‖''M''<sub>''W''</sub>‖}} we can extract a coefficient {{nowrap| sqrt(''C''(''n'', ''r'' + 1)/''C''(''n'', ''r'')) {{=}} sqrt((''n'' − ''r'')/(''r'' + 1)) }}, which relates ''Ψ'' with ''E'' as follows:  


$$ \Psi = \sqrt{\frac{r + 1}{n - r}} E $$
$$ \Psi = \sqrt{\frac{r + 1}{n - r}} E $$
Line 97: Line 91:


''G'' and ''ψ'' error both have the advantage that higher-rank temperament error corresponds directly to rank-1 error, but the RMS normalization has the further advantage that in the rank-1 case, {{nowrap| ''G'' {{=}} sin ''θ'' }} octaves, where ''θ'' is the angle between ''J''<sub>''W''</sub> and the val in question.  
''G'' and ''ψ'' error both have the advantage that higher-rank temperament error corresponds directly to rank-1 error, but the RMS normalization has the further advantage that in the rank-1 case, {{nowrap| ''G'' {{=}} sin ''θ'' }} octaves, where ''θ'' is the angle between ''J''<sub>''W''</sub> and the val in question.  
In Sintel's routine, the TE error may be derived as the ratio {{nowrap|‖''M''<sub>''U''</sub> ∧ ''J''<sub>''U''</sub>‖/‖''M''<sub>''U''</sub>‖}}, using ''U''-weighted norm (see the next section), which evaluates to the same value as Graham's definition. A hybrid RMS version of this is implemented in the [https://github.com/FloraCanou/temperament_evaluator Temperament Evaluator], with the extra factor 1/sqrt(''n'').


== TE simple badness ==
== TE simple badness ==
Line 105: Line 101:
$$ B = C \cdot E $$
$$ B = C \cdot E $$


Gene Ward Smith defines the simple badness of ''M'' as {{nowrap|‖''M''<sub>''W''</sub> ∧ ''J''<sub>''W''</sub>‖<sub>RMS</sub>}}. A perhaps simpler way to view this is to start with a mapping matrix ''V''<sub>''W''</sub> and add an extra row ''J''<sub>''W''</sub> corresponding to the just tuning map; we will label this matrix ''Ṽ''<sub>''W''</sub>. Then the simple badness is:
Graham Breed's simple badness is directly derived from this formula.
 
Gene Ward Smith defines the simple badness as {{nowrap|‖''M''<sub>''W''</sub> ∧ ''J''<sub>''W''</sub>‖<sub>RMS</sub>}}. A perhaps simpler way to view this is to start with a mapping matrix ''V''<sub>''W''</sub> and add an extra row ''J''<sub>''W''</sub> corresponding to the just tuning map; we will label this matrix ''Ṽ''<sub>''W''</sub>. Then the simple badness is:


$$ \norm{ M_W \wedge J_W }_\text {RMS'} = \sqrt{\frac{\det(\tilde V_W \tilde V_W^\mathsf{T})}{C(n, r + 1)}} $$
$$ \norm{ M_W \wedge J_W }_\text {RMS'} = \sqrt{\frac{\det(\tilde V_W \tilde V_W^\mathsf{T})}{C(n, r + 1)}} $$


So that we can basically view the simple badness as the TE complexity of the "pseudo-temperament" formed by adding the JIP to the mapping matrix as if it were another val.
So that we can basically view the simple badness as the TE complexity of the "pseudo-temperament" formed by adding the JIP to the mapping matrix as if it were another val.
Graham Breed defines the simple badness slightly differently, again equivalent to a choice of scaling, skipped here because it is derived from the general formula.


Sintel has likewise given a simple badness as
Sintel has likewise given a simple badness as
Line 120: Line 116:


=== Reduction to the span of a comma ===
=== Reduction to the span of a comma ===
It is notable that if ''M'' is codimension-1, we may view it as representing [[the dual]] of a single comma. In this situation, the simple badness happens to reduce to the [[Interval span|span]] of the comma, up to a constant multiplicative factor, so that the span of any comma can itself be thought of as measuring the complexity relative to the error of the temperament vanishing that comma.
It is notable that if ''M'' is codimension-1, we may view it as representing the [[Hodge dual]] of a single comma. In this situation, the simple badness happens to reduce to the [[Interval span|span]] of the comma, up to a constant multiplicative factor, so that the span of any comma can itself be thought of as measuring the complexity relative to the error of the temperament vanishing that comma.


This relationship also holds if TOP is used rather than TE, as the TOP damage associated with tempering out some comma ''n''/''d'' is log(''n''/''d'')/(''nd''), and if we multiply by the complexity ''nd'', we simply get log(''n''/''d'') as our result.
This relationship also holds if TOP is used rather than TE, as the TOP damage associated with tempering out some comma ''n''/''d'' is log(''n''/''d'')/(''nd''), and if we multiply by the complexity ''nd'', we simply get log(''n''/''d'') as our result.
Line 129: Line 125:
$$ L = B \cdot C^{r/(n - r)} $$
$$ L = B \cdot C^{r/(n - r)} $$


The exponent is chosen such that if we set a cutoff margin for logflat badness, there are still infinite numbers of new temperaments appearing as complexity goes up, at a lower rate which is approximately logarithmic in terms of complexity.
The exponent is chosen such that if we set a cutoff margin for logflat badness, there are still infinite numbers of new temperaments appearing as complexity goes up, at a lower rate which is approximately logarithmic in terms of complexity.{{cn}}


In Graham's and Gene's derivations,  
In Graham's and Gene's derivations,  
Line 139: Line 135:
$$ L = \norm{ M_U \wedge J_U } \norm{M_U}^{r/(n - r)} / \norm{J_U} $$
$$ L = \norm{ M_U \wedge J_U } \norm{M_U}^{r/(n - r)} / \norm{J_U} $$


Notice the extra factor 1/‖''J''<sub>''U''</sub>‖, which is to say we divide it by the norm of the just tuning map. For comparison, Gene's derivation does not have this factor, whereas with Tenney weights, whether this factor is omitted or not has no effects on Graham's derivation since ‖''J''<sub>''W''</sub>‖<sub>RMS</sub> is unity.  
Notice the extra factor 1/‖''J''<sub>''U''</sub>‖, which is to say we divide it by the norm of the just tuning map. For comparison, Gene's derivation does not have this factor, whereas with Tenney weights, it has no effects on Graham's derivation since ‖''J''<sub>''W''</sub>‖<sub>RMS</sub> is unity.  


== Examples ==
== Examples ==
Line 155: Line 151:
| 5.400
| 5.400
| 2.763
| 2.763
| 12.435×10<sup>−3</sup>
| 0.0124
|-
|-
| Septimal magic
| Septimal magic
| 7.195
| 7.195
| 2.149
| 2.149
| 12.882×10<sup>−3</sup>
| 0.0129
|}
|}
{| class="wikitable center-all left-1"
{| class="wikitable center-all left-1"
Line 173: Line 169:
| 1.350
| 1.350
| 1.382
| 1.382
| 1.554×10<sup>−3</sup>
| 0.00155
|-
|-
| Septimal magic
| Septimal magic
| 1.799
| 1.799
| 1.074
| 1.074
| 1.610×10<sup>−3</sup>
| 0.00161
|}
|}
{| class="wikitable center-all left-1"
{| class="wikitable center-all left-1"
Line 191: Line 187:
| 2.204
| 2.204
| 3.384
| 3.384
| 6.218×10<sup>−3</sup>
| 0.00622
|-
|-
| Septimal magic
| Septimal magic
| 2.937
| 2.937
| 2.631
| 2.631
| 6.441×10<sup>−3</sup>
| 0.00644
|}
{| class="wikitable center-all left-1"
|+ style="font-size: 105%;" | Sintel's norm
|-
! Temperament
! Complexity
! Error (¢)
! Simple badness
|-
| Septimal meantone
| 17.357
| 2.477
| 0.0358
|-
| Septimal magic
| 23.126
| 1.926
| 0.0371
|}
|}


Line 202: Line 216:
* [[Cangwu badness]] – a derived badness measure with a free parameter that enables one to specify a tradeoff between complexity and error
* [[Cangwu badness]] – a derived badness measure with a free parameter that enables one to specify a tradeoff between complexity and error


== Notes ==
== References ==
<references/>
<references/>