User:Overthink/The circle of relative error

12edo 3: +2.0% 5: +13.7% 7: +31.2% 9: +3.9% 11: +48.7% 13: -40.5% 15: +11.7%
Relative error of harmonics in 12edo

In an equal temperament, relative error is the amount by which the mapping of an interval or harmonic deviates from its just value. For example, in 12edo the relative error of 3/2 is -2.0%, and the relative error of 5/4 is +13.7%. We can plot the relative error of harmonics in a graph like the one on the right. This graph lets us calculate the relative error of intervals. For example, the relative error of 6/5 is 13.7%-(-2.0%)=15.6% (not 15.7% due to rounding error). Note that absolute error can be found by multiplying the relative error by the equal division's step size, and in 12edo absolute and relative error are identical. However, one may not always want to use the nearest approximation of every harmonic. For example, in 12edo, using the second best approximation for harmonic 13 (relative error +59.5%) actually gives us less error overall due to cancellation of errors between harmonics. As an example, the relative error of 13/11 in this mapping is 59.5%-48.7%=10.8%. Compare this to the patent val, where all primes use their nearest mappings, where 13/11 has an error of -40.5%-48.7%=-89.2%. If a prime is near perfectly off, the sharp and flat mappings are each the best about equally often, depending on the errors of the other harmonics. Therefore, it is natural to plot relative error not on a range from -50% to +50%, but on a circle.

The circle of relative error

 
The circle of relative error of 12edo

We plot relative error on a circle as follows: The top corresponds to zero error, far left is 25% flat, far right is 25% sharp, and the bottom is ±50% error. For each harmonic, the point corresponding to that harmonic on the circle has its angle corresponding to its relative error; the top corresponds to no error, sharper is clockwise, and flatter is counterclockwise. Note that harmonic 1 (the unison) is always on the top. The plot for 12edo, with odd harmonics up to 15, is on the right. Put simply, the relative error of a ratio between two harmonics is the distance, or length of the arc, between those harmonics on the circle. That naive definition doesn't work all the time, however. The point of the circle is that we don't always use the best mapping of each harmonic, so we must choose a point (call it the sharp-flat cutoff, or SFC) where any harmonic flatter than it uses the sharp mapping instead, and any harmonic sharper than it uses the flat mapping instead. Just to be rigorous, a harmonic exactly on the SFC is mapped to its closest mapping, though due to the fact that there is always a real number between two given real numbers, it doesn't really matter. We often choose the SFC to be at 50%, where every harmonic uses its closest mapping. Since harmonics on opposite sides of the SFC (e.g. 11 and 13 in 12edo) are mapped in opposite directions in terms of sharpness or flatness, we cannot consider the error of ratios between them off the shortest distance (minor arc) between them, but the longer distance (major arc) instead. As a more precise definition, the error of a ratio between two harmonics is the length of the arc between the points corresponding to those harmonics that doesn't cross the sharp-flat cutoff, with a full circle being 100%.


An interval is consistent if its relative error is less than 50%. This corresponds to the arc between the corresponding harmonics being less than 180 degrees, or a semicircle. An equal division of the octave is consistent in the q-odd-limit if and only if all of the arcs between two odd harmonics up to q (that don't cross the SFC) are less than 180 degrees. Note that for an EDO to be fully consistent, this property must hold with the SFC at 50%. Also note that intervals like 3/1 and 3/2 are considered equivalent and have the same relative error due to octave equivalence. The longest arc between two harmonics is the one between the harmonic closest to the SFC counterclockwise of it and the closest harmonic clockwise of it. For example, in 12edo with the SFC at 50%, the closest harmonic clockwise of the SFC is 13 at -40.5%, and the closest counterclockwise of it is 11 at +48.7%, with the distance between them being 89.2%. However, the SFC does not have to be at 50%; what if we set it at -40% (which is equivalent to +60%) instead? Then, harmonic 13 would be counterclockwise of the SFC and therefore be mapped sharply with +59.5% relative error. Note that setting the SFC to, say, -30% does the exact same thing as setting it to -40%, as harmonics are mapped the same. Though harmonic 13 itself has greater error, this reduces the error of many intervals involving it. For example, 13/11 now has a relative error of 59.5%-48.7%=10.8%. The maximum relative error of any interval in the 15-odd-limit is now 59.5%-(-3.9%)=63.4% instead; not consistent, but much better than the 89.2% we had before.

 
Circle of relative error of 35edo

Composite harmonics and dual-fifth systems

Up until now, we have assumed that mappings of composite harmonics are equal to the sum of the mappings of the primes they factor into. For example, the composite number 9 factors into primes as 3*3, and in 12edo, the mapping of harmonic 3 is 19 steps, so the mapping of harmonic 9 is 19+19=38 steps. Since the error of harmonic 3 in 12edo is low (-1.96%), this works out nicely. What if we are using a system where this doesn't work out so nicely, such as 35edo? In this case, the best approximation of harmonic 3 is 55 steps (20 reduced), but the best approximation of harmonic 9 is 111 steps (6 reduced), not the 110=55*2 that we would get by doubling 3. The 110 step approximation of harmonic 9 has a relative error of -94.7%, or an absolute error of -32.5 cents, way too much. We must therefore use the 111 step approximation that's 5.3% sharp, but the ratio between this and the best approximation of 3, 55 steps, is inconsistent, being 56 steps. However, this inconsistent approximation of 3 at 56 steps is only barely inconsistent, being 52.6% sharp with +18.0 cents error, much more reasonable than the -32.5 cents of harmonic 9 in the 110 step mapping of it. If k is the relative error of harmonic 3 in N-edo by closest approximation, and k>1/4 (25%), then the relative error of harmonic 9 by direct approximation in N-edo is 1-2k, and the relative error of the approximation of 3/1 derived from "9/3" is 1-k. The relative error of harmonic 9 by patent val would be 2k, and this is greater than the relative error 1-k of the second-best 3/1 when 2k>1-k, which simplifies to k>1/3. In general, EDOs with more than 33.3% relative error on the fifth are better analyzed as dual-fifth, and EDOs with less than 1/3 are better analyzed as plain fifth. There are of course exceptions such as 49edo, where the relative error of 3/2 is just barely over 1/3 (+33.7%), but the strong sharpness of harmonics 5, 7, and 11 means it is better analyzed as plain-fifth, and in fact 9/8 and its inversion 16/9 are the only inconsistent intervals in the 11-odd-limit in 49edo by patent val.


However, when do we actually use the sharp fifth or the flat one? In 35edo, it is best to use the flat fifth in chords like 4:5:6, 4:6:7, and 4:6:11 that use odd harmonics 1 and 3, due to the flatness of harmonics 5, 7, and 11. In a chord like 6:7:9, 6:9:10, or 6:9:11, however, it is best to use the sharp fifth between 6 and 9. In a larger chord like 4:5:6:7:9:11 that includes all of harmonics 1, 3, and 9, it is best to use the flat fifth between 1 (4) and 3 (6), and the sharp fifth between 3 (6) and 9. While these chords work well, some don't, such as 8:10:12:15, which will have an interval almost 75% (about 25 cents) off no matter how it is tuned in 35edo. 35edo is actually quite optimal in its tunings for 5 and 7, both being about a quarter of a step flat to split the errors evenly in chords like 4:5:6 and 6:7:9, and while its 11 is not as optimal for this, it instead prioritzes the 11th harmonic itself, but it still works in chords. Even prime 13 arguably works if its inconsistent flat mapping is used. The specifics of how a dual-fifth system works depends on the edo being used; for example, 47edo works differently from 35edo.


I propose a wart notation for dual-prime systems using upside-down warts to represent dual primes, for example 35edo's best 13-limit "val" is 35qf, and 70edo's best "val" is 70ↄp. Note that upside-down letters are rotated 180 degrees from their regular versions. There is a slight possibility that the dual warts for 3 and 7, being q and p respectively, conflict with the regular warts for primes 59 and 53, but it is very unlikely that this will happen. However, I'm not going to explicitly define the details of this dual wart system, and someone else can do that if they want instead.

Minimal inconsistency count of an EDO

When using edos to approximate high-limit just intonation, we want to avoid inconsistencies as much as possible, though there are very few edos that avoid inconsistencies completely to a large odd limit. If there are a nonzero number of inconsistences of an edo in an odd limit, it is often best to not use the best mapping of every harmonic. Note that I will be using a somewhat idiosyncratic approach of considering composite harmonics like 9 independently of its prime factors, and treating consistency of unsimplified ratios between harmonics like 9/6 as seperate from simplified ones like 3/2. For example, in 35edo with best mappings of odds 3 and 9, 3/2 and 9/8 are considered consistent, but 9/6 is not. A neat thing about this is that regardless of our SFC, no interval will ever be mapped with more than 100% relative error. We define the minimal inconsistency count (MIC) of n-edo in the q-odd-limit to be the minimum number of inconsistent ratios in the q-odd-limit for any SFC. For example, the MIC of 35edo in the 13-odd-limit is achieved when we set the SFC to have 9 mapped sharp and 13 mapped flat; anywhere between +5.3%/-94.7% and +48.5%/-51.5%. In this mapping, the only inconsistencies are 9/6, 13/9, 13/8, and their inversions, so the MIC of 35edo in the 13-odd-limit is 3. Note that an interval and its inversion, such as 7/6 and 12/7, are not counted separately, but instead as one interval. However, the minimum inconsistency count is sometimes quite tricky to figure out, especially in cases like 35edo in the 15-odd-limit, where its hard to even make an educated guess due to the errors of harmonics being all over the place, but it is much easier for a program to figure this out by brute-forcing each of the SFC ranges with distinct mappings (arcs between harmonics adjacent on the circle).


However, we sometimes don't exactly want to choose the mapping with fewest inconsistencies, but instead optimize lower limits.