The Riemann zeta function and tuning: Difference between revisions

Sintel (talk | contribs)
Quick info: zeta peak edos: Fix error: switched pure octaves, rewrite
BudjarnLambeth (talk | contribs)
No edit summary
 
(60 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Texops}}
{{Texops}}
{{Wikipedia|Riemann zeta function}}
{{Wikipedia|Riemann zeta function}}
The Riemann zeta function is a famous mathematical function, best known for its relationship with the Riemann hypothesis, a 200-year old unsolved problem involving the distribution of the prime numbers. However, it also has an intriguing musical interpretation: the zeta function shows how ‘well’ a given [[equal temperament]] approximates the no-limit [[just intonation]] relative to its size.  
The Riemann zeta function is a famous mathematical function, best known for its relationship with the Riemann hypothesis, a 200-year old unsolved problem involving the distribution of the prime numbers. However, it also has an intriguing musical interpretation: the zeta function shows how "well" a given [[equal temperament]] approximates the no-limit [[just intonation]] relative to its size.  


As a result, although the zeta function is best known for its use in analytic number theory, the zeta function is present in the background of some tuning theory — the [[harmonic entropy]] model of [[concordance]] can be shown to be related to the Fourier transform of the zeta function, and several tuning-theoretic metrics, if extended to the infinite-limit, yield expressions that are related to the zeta function. Sometimes these are in terms of the "prime zeta function", which is closely related and can also be derived as a simple expression of the zeta function.
As a result, although the zeta function is best known for its use in analytic number theory, the zeta function is present in the background of some tuning theory — the [[harmonic entropy]] model of [[concordance]] can be shown to be related to the Fourier transform of the zeta function, and several tuning-theoretic metrics, if extended to the infinite-limit, yield expressions that are related to the zeta function. Sometimes these are in terms of the "prime zeta function", which is closely related and can also be derived as a simple expression of the zeta function.
Line 7: Line 7:
If you look for a filter to quickly sort all the equal temperaments into those that approximate JI well and those that do not, the [[#Zeta edo lists|edo lists]] below can be useful. The caveat is that it collapses the variety of characteristics of a temperament to a one-dimensional rating, with little capacity to show the nuances of each system. It is therefore best to keep in mind that judging the temperaments by zeta is no replacement for investigating each temperament in detail.  
If you look for a filter to quickly sort all the equal temperaments into those that approximate JI well and those that do not, the [[#Zeta edo lists|edo lists]] below can be useful. The caveat is that it collapses the variety of characteristics of a temperament to a one-dimensional rating, with little capacity to show the nuances of each system. It is therefore best to keep in mind that judging the temperaments by zeta is no replacement for investigating each temperament in detail.  


There are other metrics besides zeta for other definitions of "approximating well", such as [[mu badness]] and the various [[:Category:Regular temperament tuning|optimised regular temperament tunings]] when applied to [[rank]]-1 (i.e. equal) temperaments.
There are other metrics besides zeta for other definitions of "approximating well", which you can find in: [[:Category:Regular temperament tuning|optimised regular temperament tunings]].


Much of the below is thanks to the insights of [[Gene Ward Smith]]. Below is the original derivation as he presented it, followed by a different derivation from [[Mike Battaglia]] below which extends some of the results.
Much of the below is thanks to the insights of [[Gene Ward Smith]]. Below is the original derivation as he presented it, followed by a different derivation from [[Mike Battaglia]] below which extends some of the results.
Line 16: Line 16:
'''Zeta record edo:''' An equal tuning that sets some kind of record in regards to the zeta function compared to all smaller equal tunings.
'''Zeta record edo:''' An equal tuning that sets some kind of record in regards to the zeta function compared to all smaller equal tunings.


'''Zeta record peak:''' A zeta record equal tuning, evaluated by the absolute "goodness" of the edo according to the zeta function. This is a tuning which is closer to JI than any previous tuning, and is usually an EDO with compressed or stretched octaves.
'''Record zeta peak:''' An equal tuning which is closer to JI than any previous tuning, and is usually an EDO with compressed or stretched octaves, evaluated by the absolute "goodness" of the edo according to the zeta function.


'''Zeta record integer:''' A zeta record edo by absolute "goodness", when compared only to other edos (i.e. ignoring nonoctave tunings and stretched/compressed octaves).
'''Record zeta peak integer:''' A zeta record edo by absolute "goodness", when compared only to other edos (i.e. ignoring stretched/compressed equivalences).


'''Zero:''' A point where the Riemann zeta function is equal to zero, such as ~2.759edo, representing an equal tuning that does not represent JI much at all. EDOs close to zeroes are called zeta valley EDOs; all known zeroes are on the "critical line" used to obtain tuning information.  
'''Zero:''' A point where the Riemann zeta function is equal to zero, such as ~2.759edo, representing an equal tuning that does not represent JI much at all. EDOs close to zeroes are called ''zeta valley EDOs''; all known zeroes are on the "critical line" used to obtain tuning information.  


'''Zeta record gap:''' A zeta record edo by the size of the gap between its surrounding zeroes, adjusted for the fact that zeroes generally become more dense with larger inputs.
'''Record z gap:''' A zeta record edo by the size of the gap between its surrounding zeroes, adjusted for the fact that zeroes generally become more dense with larger inputs.


'''Zeta record integral:''' A zeta record edo by the size of the area enclosed by the shape of the function between the edo's surrounding zeroes.  
'''Record zeta integral:''' A zeta record edo by the size of the area enclosed by the shape of the function between the edo's surrounding zeroes.


== Quick info: zeta peak edos ==
== Quick info: zeta peak edos ==
These lists give the best [[equal divisions of the octave]] for their size according to the zeta metric.
These lists give the best [[equal divisions of the octave]] for their size according to the zeta metric.


Zeta peak integer EDOs (Pure octaves): {{EDOs|1, 2, 3, 5, 7, 10, 12, 19, 22, 31, 41, 53, 87, 118, 130, 171, 224, 270, 311, ...}}
Zeta peak integer EDOs (pure octaves): {{EDOs|1, 2, 3, 5, 7, 10, 12, 19, 22, 31, 41, 53, 87, 118, 130, 171, 224, 270, 311, ...}}
 
Zeta peak EDOs (Detuned octaves): {{EDOs|1, 2, 3, 4, 5, 7, 10, 12, 19, 22, 27, 31, 41, 53, 72, 99, 118, 130, 152, 171, 217, 224, 270, ...}}
Zeta peak EDOs (tempered octaves): {{EDOs|1, 2, 3, 4, 5, 7, 10, 12, 19, 22, 27, 31, 41, 53, 72, 99, 118, 130, 152, 171, 217, 224, 270, ...}}
 
See the [[#Zeta edo lists|section below]] for more information.
See the [[#Zeta edo lists|section below]] for more information.


== Intuitive explanation ==
== Graph links ==
We start with the basic concept of the mu function, which takes a cyclic function (a zigzag, in the case of mu) and sums up the values of that function scaled and weighted (canonically by a quadratic factor 1/n^2, but can be varied) to match each harmonic n. Technically, any cyclic function can be used this way. Specifically, complex exponentials are especially useful as a) they are analytic and b) they package the "weight" and the cyclic function together into a single function, where the weight corresponds to the real value of the input s, and so equal tunings are the imaginary part of the input. (Imaginary numbers most directly correspond to equal divisions of the [[zetave]] (e<sup>𝜏</sup>), this is because of the close connection between complex exponentials and both e and the circle constant. To convert to edos, multiply the imaginary part by <sup>𝜏</sup>/<sub>ln(2)</sub>.) The sum of complex exponentials corresponding to each harmonic is, by definition, the zeta function, and it turns out that the weight 1/sqrt(n) gives the optimal information on higher primes, corresponding to the critical line where all known zeroes lie (intuitively, smaller weights lead to higher primes dominating too much and obscuring lower primes, and larger weights lead to the converse).  
A link to the graph of zeta can be found at [https://samuelj.li/complex-function-plotter/#abs(zeta(i*2*pi*real(z)%2Fln(2)%2Bimag(z))) Zeta in Samuelj Plotter]. (In the top left menu, make sure that "Enable Checkerboard" is unticked and "Invert Gradient" and "Continuous Gradient" are ticked.) The function has been reoriented to place EDO size along the horizontal axis and weight along the vertical axis, and also scaled by {{sfrac|2π|ln(2)}} to ensure that the real number line aligns with edos. One can see that with higher weights, the function approaches a cyclic function with a period of 1; this corresponds to the prime 2 dominating more and more extremely as other harmonics are weighted less with higher weights. You can see this easier by raising the entire expression to an absurdly high power, such as 100. Note, however, that this visualization is inaccurate beyond a couple hundred: around 146.5, 324.5 and 473.5, and in many cases after, there appear to be zeroes that are not on the critical line; this is an artifact of the way the function is approximated and is the ultimate reason why the Riemann hypothesis remains unsolved. These actually correspond to zeroes that are very close together but on the critical line.


A link to the graph of zeta can be found at [https://samuelj.li/complex-function-plotter/#abs(zeta(i*2*pi*real(z)%2Fln(2)%2Bimag(z))) Zeta in Samuelj Plotter]. (In the top left menu, make sure that "Enable Checkerboard" is unticked and "Invert Gradient" and "Continuous Gradient" are ticked.) The function has been reoriented to place EDO size along the horizontal axis and weight along the vertical axis, and also scaled by <sup>𝜏</sup>/<sub>ln(2)</sub> to ensure that the real number line aligns with edos. One can see that with higher weights, the function approaches a cyclic function with a period of 1; this corresponds to the prime 2 dominating more and more extremely as other harmonics are weighted less with higher weights. You can see this easier by raising the entire expression to an absurdly high power, such as 100. Note, however, that this visualization is inaccurate beyond a few hundred: around 324.5 and 473.5, and in many cases after, there appear to be zeroes that are not on the critical line; this is an artifact of the way the function is approximated and is the ultimate reason why the Riemann hypothesis remains unsolved.  
You may also view the graph of zeta along the critical line on Desmos: [https://www.desmos.com/calculator/dstp7wnidf Zeta in Desmos]. This makes it easier to see peaks, but only works for {{nowrap|σ {{=}} {{sfrac|1|2}}}}.  


== Gene Smith's original derivation ==
=== Plots ===
=== The relation of zeta to tuning ===
Below are some demonstrative plots of the zeta function (strictly speaking, the [[#The Z function: a mathematically convenient version of zeta|Z function]]) on the critical line.
Suppose ''x'' is a variable representing some equal division of the octave. For example, if {{nowrap|''x'' {{=}} 80}}, ''x'' reflects 80edo with a step size of 15 cents and with pure octaves. Suppose that ''x'' can also be continuous, so that it can also represent fractional or "nonoctave" divisions as well. The [[Bohlen–Pierce scale]], 13 equal divisions of 3/1, is approximately 8.202 equal divisions of the "octave" (although the octave itself does not appear in this tuning), and would hence be represented by a value of {{nowrap|''x'' {{=}} 8.202}}.


Now suppose that [https://www.desmos.com/calculator/krigk43int {{rr|''x''}}] denotes the difference between ''x'' and the integer nearest to ''x'':
Using the [http://functions.wolfram.com/webMathematica/FunctionPlotting.jsp?name=RiemannSiegelZ online plotter] we can plot Z in the regions corresponding to scale divisions, using the conversion factor {{nowrap|''t'' {{=}} {{sfrac|2π|ln(2)}}''x''}}, for ''x'' a number near or at an edo number. Hence, for instance, to plot 12 plot around 108.777, to plot 31 plot around 281.006, and so forth. An alternative plotter is the applet [http://web.viu.ca/pughg/RiemannZeta/RiemannZetaLong.html here].


<math>\rround{x} = \abs{x - \floor{x + \frac{1}{2}}}</math>
If you have access to {{w|Mathematica}}, which has Z, zeta and theta as a part of its suite of initially defined functions, you can do even better. Below is a Mathematica-generated plot of Z{{pars|{{sfrac|2π''x''|ln(2)}}|1.8}} in the region around [[12edo]]:


For example, {{nowrap|{{rr|8.202}} {{=}} 0.202}}, since it is the difference between 8.202 and the nearest integer, which is 8. Meanwhile, {{nowrap|{{rr|7.95}} {{=}} 0.05}}, which is the difference between 7.95 and the nearest integer, which is 8. This represents the absolute relative error of the octave in equal tuning ''x'', or alternatively how much x is detuned from an edo.
[[File:plot12.png|alt=plot12.png|plot12.png]]


For any value of ''x'', we can construct a ''p''-limit [[Patent_val|generalized patent val]]. We do so by rounding {{nowrap|''x'' log<sub>2</sub>(''q'')}} to the nearest integer for each prime ''q'' up to ''p''. For example, for {{nowrap|''x'' {{=}} 12}}, we find 2 at 12, 3 at 19, 5 at 28, etc. Now consider [https://www.desmos.com/calculator/4uamhon9tt the function]
The peak around 12 is both higher and wider than the local maximums above 11 and 13, indicating its superiority as an approximation of JI. Note also that the peak occurs at a point slightly larger than 12; this indicates the octave is slightly compressed in the zeta tuning for 12. The size of a step in octaves is 1/''x'', and hence the size of the octave in the zeta peak value tuning for ''N''edo is ''N''/''x''; if ''x'' is slightly larger than ''N'' as here with {{nowrap|''N'' {{=}} 12}}, the size of the zeta tuned octave will be slightly less than a pure octave. Similarly, when the peak occurs with ''x'' less than ''N'', we have stretched octaves.


<math>\displaystyle \xi_p(x) = \sum_{\substack{2 \leq q \leq p \\ q \text{ prime}}} \left(\frac{\rround{x \log_2 q}}{\log_2 q}\right)^2</math>
For larger edos, the width of the peak narrows, but for strong edos the height more than compensates, measured in terms of the area under the peak (the absolute value of the integral of Z between two zeros.) Note how [[270edo]] completely dominates its neighbors:


Here, the numerator represents the relative error on each prime, and the denominator represents a weight factor of the logarithm of each prime, so the function represents a p-limit badness metric.
[[File:plot270.png|alt=plot270.png|plot270.png]]


This function has local minima, corresponding to associated generalized patent vals. The minima occur for values of ''x'' which are the [[Tenney-Euclidean_Tuning|Tenney-Euclidean tuning]]s of the octaves of the associated vals, while ξ<sub>''p''</sub> for these minima is the square of the [[Tenney–Euclidean metrics|Tenney–Euclidean relative error]] of the val—equal to the TE error times the TE complexity, and sometimes known as "TE simple badness."
Note that for one of its neighbors, 271, it isn't entirely clear which peak value corresponds to the line of real values from +∞. This can be determined by looking at the absolute value of zeta along other ''s'' values, such as {{nowrap|''s'' {{=}} 1}} or {{nowrap|''s'' {{=}} {{sfrac|3|4}}}}, and in this case the local minimum at 271.069 is the value in question. However, other peak values are not without their interest; the local maximum at 270.941, for instance, is associated to a different mapping for 3.


Now suppose we don't want a formula for any specific prime limit, but which applies to all primes. We can't take the above sum to infinity, since it doesn't converge. However, we could [https://www.desmos.com/calculator/0qhhewlsaz change the weighting factor to a power] so that it does converge:
To generate this plot using the free version of Wolfram Cloud, you can run <code>Plot[Abs[RiemannSiegelZ[9.06472028x]], {x, 11.9, 12.1}]</code> and then in the menu select '''Evaluation &gt; Evaluate Cells'''. Change "'''11.9'''" and "'''12.1'''" to whatever values you want, e.g. to view the curve around 15edo you might use the values "'''14.9'''" and "'''15.1'''".


<math>\displaystyle \xi_\infty(x) = \sum_{\substack{q \geq 2 \\ q \text{ prime}}} \frac{\rround{x \log_2 q}^2}{q^s}</math>
You can also view the plot using [https://www.desmos.com/calculator/dstp7wnidf Zeta in Desmos].


Seeing that we notate the power as ''s'', it might become apparent where the Riemann zeta function will eventually show up.
== Gene Smith's original derivation ==
Suppose ''x'' is a variable representing some equal division of the octave. For example, if {{nowrap|''x'' {{=}} 80}}, ''x'' corresponds to [[80edo]] with a step size of 15 [[cent]]s and with pure octaves. Suppose that ''x'' can also be continuous, so that it can also represent fractional or "nonoctave" divisions as well, so that it ranges over all possible [[equal temperament]]s. The [[Bohlen–Pierce scale]], 13 equal divisions of 3/1, is approximately 8.202 equal divisions of the "octave" (although the octave itself does not appear in this tuning), and would hence be represented by a value of {{nowrap|''x'' {{=}} 8.202}}.


If ''s'' is greater than one, this does converge. However, we might want to make a few adjustments. For one thing, if the error is low enough that the tuning is consistent, then the error of the square of a prime is twice that of the prime, of the cube tripled, and so forth until the error becomes inconsistent. When the weighting uses logarithms and error measures are consistent, then the logarithmic weighting cancels this effect out, so we might consider that prime powers were implicitly included in the Tenney-Euclidean measure. We can go ahead and include them by adding a factor of {{sfrac|1|''n''}} for each prime power ''p''<sup>''n''</sup>. A somewhat peculiar but useful way to write the result of doing this is in terms of the {{w|Von Mangoldt function}}, an {{w|arithmetic function}} on positive integers which is equal to ln(''p'') on prime powers ''p''<sup>''n''</sup>, and is zero elsewhere. This is written using a capital lambda, as Λ(''n''), and in terms of it we can include prime powers in our error function as
Now suppose that [https://www.desmos.com/calculator/krigk43int {{rr|''x''}}] denotes the difference between ''x'' and the integer nearest to ''x'':


<math>\displaystyle \xi_\infty(x) = \sum_{n \geq 1} \frac{\Lambda(n)}{\ln n} \frac{\rround{x \log_2 n}^2}{n^s}</math>
<math>
\lfloor x \rceil = \left| x - \left\lfloor x + \frac{1}{2} \right\rfloor \right|
</math>


where the summation is taken formally over all positive integers, though only the primes and prime powers make a nonzero contribution.
For example, {{nowrap|{{rr|8.202}} {{=}} 0.202}}, since it is the difference between 8.202 and the nearest integer, which is 8. Meanwhile, {{nowrap|{{rr|7.95}} {{=}} 0.05}}, which is the difference between 7.95 and the nearest integer, which is 8. This represents the absolute relative error of the octave in equal tuning ''x'', or alternatively how much x is detuned from an edo.


Another consequence of the above definition which might be objected to is that it results in a function with a {{w|Continuous function#Relation to differentiability and integrability|discontinuous derivative}}, whereas a smooth function be preferred. The function ⌊''x''<sup>2</sup> is quadratically increasing near integer values of ''x'', and is periodic with period 1. Another function with these same properties is {{nowrap|1 − cos(2π''x'')}}, which is a smooth and in fact an {{w|entire function}}. Let us therefore now define for any {{nowrap|''s'' &gt; 1}}:
For any value of ''x'', we can construct a ''p''-[[limit]] [[val]] by rounding {{nowrap|''x'' log<sub>2</sub>(''q'')}} to the nearest integer for each prime ''q'' up to ''p''. (More technically, this corresponds to what's known as a [[generalized patent val]].) For example, for {{nowrap|''x'' {{=}} 12}}, we find 2 at 12, 3 at 19, 5 at 28, etc. Now consider [https://www.desmos.com/calculator/4uamhon9tt the function]


<math>\displaystyle E_s(x) = \sum_{n \geq 1} \frac{\Lambda(n)}{\ln n} \frac{1 - \cos(2 \pi x \log_2 n)}{n^s}</math>
<math>
\displaystyle \xi_p(x)
= \sum_{\substack{2 \leq q \leq p \\ q \text{ prime}}} \left(\frac{\lfloor x \log_2 q \rceil}{\log_2 q}\right)^2
</math>


For any fixed {{nowrap|''s'' &gt; 1}} this gives a real {{w|analytic function}} defined for all ''x'', and hence with all the smoothness properties we could desire.
Here, the numerator represents the relative error on each prime, and the denominator represents a weight factor of the logarithm of each prime*, so the function represents a p-limit badness metric.


We can clean up this definition to get essentially the same function:
(<nowiki>*</nowiki> Specifically, the reason we use the weighting 1/log<sub>2</sub>(''p'') is because of certain desirable properties it has that singles it out as of unique interest: if the complexity of a prime ''p'' is {{nowrap| log<sub>2</sub>(''p'') }}, then ''p''<sup>n</sup> is ''n'' times as complex as ''p''. Using {{nowrap| log<sub>2</sub>(''p'') }} as the complexity also means that the complexity of a harmonic, according to its prime factorization, exactly matches where it's found in the harmonic series, so that e.g. {{nowrap| 25 {{=}} 5 × 5 }} is slightly less complex than {{nowrap| 26 {{=}} 2 × 13 }} is slightly less complex than {{nowrap| 27 {{=}} 3 × 3 × 3 }}. Therefore, the {{nowrap| 1/log<sub>2</sub>(''p'') }} weighting is a kind of natural inverse-complexity weighting, that is, a simplicity weighting.)


<math>\displaystyle F_s(x) = \sum_{n \geq 1} \frac{\Lambda(n)}{\ln n} \frac{\cos(2 \pi x \log_2 n)}{n^s}</math>
(Also, for those unfamiliar, squaring the error is commonly done because it solves the flaws of two alternative ways of measuring error. Specifically, if you look only at the maximum error, you miss opportunities to make the tuning much better ''overall'' by allowing slightly more damage on the most damaged intervals, while if you look only at the average error, then it may be that you are unnecessarily damaging a few intervals a lot just to get intervals that are already in-tune slightly more in-tune, so both extremes have pathological behaviours, and using the squared error counters both of these behaviours so that it represents a more balanced approach to optimization that is used in a variety of disciplines.)


This new function has the property that {{nowrap|F<sub>s</sub>(''x'') {{=}} F<sub>s</sub>(0) − E<sub>s</sub>(''x'')}}, so that all we have done is flip the sign of E<sub>s</sub>(''x'') and offset it vertically. This now increases to a maximum value for low errors, rather than declining to a minimum. Of more interest is the fact that it is a known mathematical function, which can be expressed in terms of the real part of the logarithm of the {{w|Riemann zeta function}}:
This function has local minima, corresponding to associated generalized patent vals. The minima occur for values of ''x'' which are the [[Tenney-Euclidean_Tuning|Tenney-Euclidean tuning]]s of the octaves of the associated vals, while ξ<sub>''p''</sub> for these minima is the square of the [[Tenney–Euclidean relative error]] of the val—equal to the TE error times the TE complexity, and sometimes known as "TE simple badness."


<math>\displaystyle F_s(x) = \Re \ln \zeta\left(s + \frac{2 \pi i}{\ln 2}x\right)</math>
Now suppose we don't want a formula for any specific prime limit, but which applies to all primes. We can't take the above sum to infinity, since it doesn't converge. However, we could [https://www.desmos.com/calculator/0qhhewlsaz change the weighting factor to a power] so that it does converge:


{{Todo|expand|inline=1|text=Make it clear how Fₛ(x) relates to the zeta function. Due to the sudden appearance of the natural logarithm and the imaginary unit i, this appears to have to do with complex exponentials (i.e. those found in the denominator of the terms of zeta when the input is complex), but it would be more approachable if the precise derivation was laid out here.}}
<math>\displaystyle \xi_\infty(x) = \sum_{\substack{q \geq 2 \\ q \text{ prime}}} \frac{\lfloor x \log_2 q \rceil^2}{q^s}</math>


If we take exponentials of both sides, then
Importantly, when {{nowrap|''s'' {{=}} 1}}, the weighting is 1/''p'' for a prime ''p'', so that it's very similar to a {{sfrac|1|''p'' − 1}} weighting. This latter weighting is equal to the average number of times prime ''p'' occurs as a factor in the harmonic series, counting repetition, so is of interest because it represents how many harmonics will feel damage from this prime being mistuned. Therefore, the weighting {{nowrap| 1/''p''  }} corresponds to under-prioritizing small primes slightly (with the effect being less slight the smaller the prime, so that at the most extreme, at prime 2 we have 1/2 instead of 1/1 weighting and at prime 3 we have 1/3 instead of 1/2 weighting).


<math>\displaystyle \exp(F_s(x)) = \abs{\zeta\left(s + \frac{2 \pi i}{\ln 2}x\right)}</math>
Seeing that we notate the power as ''s'', it might become apparent where the Riemann zeta function will eventually show up.


so that we see that the absolute value of the zeta function serves to measure the relative error of an equal division.
If ''s'' is greater than one, this does converge. However, we might want to make a few adjustments. For one thing, if the error is low enough that the tuning is consistent, then the error of the square of a prime is twice that of the prime, of the cube tripled, and so forth until the error becomes inconsistent. When the weighting uses logarithms and error measures are consistent, then the logarithmic weighting cancels this effect out, so we might consider that prime powers were implicitly included in the Tenney-Euclidean measure—in fact, the primary intuition behind Tenney weighting is that it is the weighting pattern that values 25, 27, and 29 approximately evenly in importance despite being different powers. We can go ahead and include them by adding a factor of {{sfrac|1|''n''}} for each prime power ''p''<sup>''n''</sup>. A somewhat peculiar but useful way to write the result of doing this is in terms of the {{w|von Mangoldt function}}, an {{w|arithmetic function}} on positive integers which is equal to ln(''p'') on prime powers ''p''<sup>''n''</sup>, and is zero elsewhere. This is written using a capital lambda, as Λ(''n''), and in terms of it we can include prime powers in our error function as


=== The critical strip, zeta peaks, and Gram points ===
<math>\displaystyle \xi_\infty(x) = \sum_{n \geq 1} \frac{\Lambda(n)}{\ln n} \frac{\lfloor x \log_2 n \rceil^2}{n^s}</math>
So long as {{nowrap|''s'' &ge; 1}}, the absolute value of the zeta function can be seen as a relative error measurement. However, the rationale for that view of things departs when {{nowrap|''s'' &lt; 1}}, particularly in the [http://mathworld.wolfram.com/CriticalStrip.html critical strip], when {{nowrap|0 &lt; ''s'' &lt; 1}}. As s approaches the value {{nowrap|''s'' {{=}} {{sfrac|1|2}}}} of the [http://mathworld.wolfram.com/CriticalLine.html critical line], the information content, so to speak, of the zeta function concerning higher primes increases and it behaves increasingly like a badness measure (or more correctly, since we have inverted it, like a goodness measure.) The quasi-symmetric [https://planetmath.org/encyclopedia/FunctionalEquationOfTheRiemannZetaFunction.html functional equation] of the zeta function tells us that past the critical line the information content starts to decrease again, with {{nowrap|1 − ''s''}} and ''s'' having the same information content. Hence it is the zeta function between {{nowrap|''s'' {{=}} {{sfrac|1|2}}}} and {{nowrap|''s'' {{=}} 1}}, and especially the zeta function along the critical line {{nowrap|''s'' {{=}} {{sfrac|1|2}}}}, which is of the most interest.


==== Introduction to Gram points ====
where the summation is taken formally over all positive integers, though only the primes and prime powers make a nonzero contribution.
As {{nowrap|''s'' &gt; 1}} gets larger, the Dirichlet series for the zeta function is increasingly dominated by the 2 term, getting ever closer to simply {{nowrap|1 + 2<sup>−''z''</sup>}}, which approaches 1 as {{nowrap|''s'' {{=}} Re(''z'')}} becomes larger. When {{nowrap|''s'' ≫ 1}} and ''x'' is an integer, the real part of zeta is approximately {{nowrap|1 + 2<sup>−''s''</sup>}}, and the imaginary part is approximately zero; that is, zeta is approximately real. Starting from {{nowrap|''s'' {{=}} +&infin;}} with ''x'' an integer, we can trace a line back towards the critical strip on which zeta is real. Since when {{nowrap|''s'' ≫ 1}} the derivative is approximately −{{sfrac|ln(2)|2<sup>''s''</sup>}}, it is negative on this line of real values for zeta, meaning that the real value for zeta increases as ''s'' decreases. The zeta function approaches 1 uniformly as ''s'' increases to infinity, so as ''s'' decreases, the real-valued zeta function along this line of real values continues to increase though all real values from 1 to infinity monotonically. When it crosses the critical line where {{nowrap|''s'' {{=}} {{sfrac|1|2}}}}, it produces a real value of zeta on the critical line. Points on the critical line where {{nowrap|ζ({{frac|1|2}} + ''ig'')}} are real are called "Gram points", after {{w|Jørgen Pedersen Gram}}. We thus have associated pure-octave edos, where ''x'' is an integer, to a value near to the pure octave, at the special sorts of Gram points which corresponds to edos.


==== Gram points and zeta peaks ====
Another consequence of the above definition which might be objected to is that it results in a function with a {{w|Continuous function#Relation to differentiability and integrability|discontinuous derivative}}, whereas a smooth function be preferred. The function ⌊''x''⌉<sup>2</sup> is quadratically increasing near integer values of ''x'', and is periodic with period 1. Another function with these same properties is {{nowrap|1 − cos(2π''x'')}}, which is a smooth and in fact an {{w|entire function}}. Let us therefore now define for any {{nowrap|''s'' &gt; 1}}:
Because the value of zeta increased continuously as it made its way from +&infin; to the critical line, we might expect the values of zeta at these special Gram points to be relatively large. This would be especially true if −ζ′(''z'') is getting a boost from other small primes as it travels toward the Gram point. A complex formula due to {{w|Bernhard Riemann}} which he failed to publish because it was so nasty becomes a bit simpler when used at a Gram point. It is named the {{w|Riemann–Siegel formula}} since {{w|Carl Ludwig Siegel}} went looking for it and was able to reconstruct it after rooting industriously around in Riemann's unpublished papers. From this formula, it is apparent that when x corresponds to a good edo, the value of {{nowrap|ζ({{frac|1|2}} + ''ig'')}} at the corresponding Gram point should be especially large.


=== The Z function: a mathematically convenient version of zeta ===
<math>\displaystyle E_s(x) = \sum_{n \geq 1} \frac{\Lambda(n)}{\ln n} \frac{1 - \cos(2 \pi x \log_2 n)}{n^s}</math>
The absolute value of {{nowrap|ζ({{frac|1|2}} + ''ig'')}} at a Gram point corresponding to an edo is near to a local maximum, but not actually at one. At the local maximum, of course, the partial derivative of {{nowrap|ζ({{frac|1|2}} + ''it'')}} with respect to ''t'' will be zero; however this does not mean its derivative there will be zero. In fact, the {{w|Riemann hypothesis}} is equivalent to the claim that all zeros of {{nowrap|ζ′(''s'' + ''it'')}} occur when {{nowrap|''s'' &gt; {{sfrac|1|2}}}}, which is where all known zeros lie. These do not have values of ''t'' corresponding to good edos. For this and other reasons, it is helpful to have a function which is real for values on the critical line but whose absolute value is the same as that of zeta. This is provided by the {{w|''Z'' function}}.


In order to define the Z function, we need first to define the {{w|Riemann–Siegel theta function}}, and in order to do that, we first need to define the [http://mathworld.wolfram.com/LogGammaFunction.html Log Gamma function]. This is not defined as the natural log of the Gamma function since that has a more complicated branch cut structure; instead, the principal branch of the Log Gamma function is defined as having a branch cut along the negative real axis, and is given by the series
For any fixed {{nowrap|''s'' &gt; 1}} this gives a real {{w|analytic function}} defined for all ''x'', and hence with all the smoothness properties we could desire.


<math>\displaystyle\Upsilon(z) = -\gamma z - \ln z + \sum_{k=1}^\infty \left(\frac{z}{k} - \ln\left(1 + \frac{z}{k}\right)\right)</math>
We can clean up this definition to get essentially the same function:


where γ is the {{w|Euler–Mascheroni constant}}. We now may define the Riemann–Siegel theta function as
<math>\displaystyle F_s(x) = \sum_{n \geq 1} \frac{\Lambda(n)}{\ln n} \frac{\cos(2 \pi x \log_2 n)}{n^s}</math>


<math>\displaystyle\theta(z) = \frac{\Upsilon\left(\frac{1 + 2 i z}{4}\right) - \Upsilon\left(\frac{1 - 2 i z}{4}\right)}{2 i} - \frac{\ln(\pi)}{2} z</math>
This new function has the property that {{nowrap|F<sub>s</sub>(''x'') {{=}} F<sub>s</sub>(0) − E<sub>s</sub>(''x'')}}, so that all we have done is flip the sign of E<sub>s</sub>(''x'') and offset it vertically. This now increases to a maximum value for low errors, rather than declining to a minimum.


Another approach is to substitute {{nowrap|''z'' {{=}} {{sfrac|1 + 2''it''|4}}}} into the series for Log Gamma and take the imaginary part, this yields
Of more interest is the fact that it is a known mathematical function. The logarithm of the {{w|Riemann zeta function}} function {{subpage|appendix|u|s=Dirichlet series for the von Mangoldt function|text=can be expressed}} in terms of a {{w|Dirichlet series}} involving the von Mangoldt function:


<math>\displaystyle \theta(t) = -\frac{\gamma + \log \pi}{2}t - \arctan 2t
<math>\displaystyle
+ \sum_{n=1}^\infty \left(\frac{t}{2n}
\ln \zeta(s)=\sum_{n=2}^\infty \frac{\Lambda(n)}{\ln(n)}\,\frac{1}{n^s}
- \arctan\left(\frac{2t}{4n+1}\right)\right)</math>
</math>


Since the arctangent function is holomorphic in the strip with imaginary part between −1 and 1, it follows from the above formula, or arguing from the previous one, that θ is holomorphic in the strip with imaginary part between −{{frac|1|2}} and {{frac|1|2}}. It may be described for real arguments as an odd real analytic function of ''x'', increasing when {{nowrap|{{abs|''x''}} &gt; 6.29}}. Plots of it may be studied by use of the Wolfram [http://functions.wolfram.com/webMathematica/FunctionPlotting.jsp?name=RiemannSiegelTheta online function plotter].
We can rewrite the cosine term in <math>F_s(x)</math> using the real part of an exponential:


Using the theta and zeta functions, we define the {{w|Z function}} as
<math>\displaystyle
\cos(2 \pi x \log_2 n)
= \mathrm{Re}\left( \exp{(- 2 \pi i x \log_2 n)} \right)
= \mathrm{Re}\left( n^{- \frac{2 \pi i}{\ln 2} x} \right)
</math>


<math>Z(t) = \exp(i \theta(t)) \zeta\left(\frac{1}{2} + it\right)</math>
Substituting back into <math>F_s(x)</math> gives:


Since θ is holomorphic on the strip with imaginary part between −{{sfrac|1|2}} and {{sfrac|1|2}}, so is Z. Since the exponential function has no zeros, the zeros of Z in this strip correspond one to one with the zeros of ζ in the critical strip. Since the exponential of an imaginary argument has absolute value 1, the absolute value of Z along the real axis is the same as the absolute value of ζ at the corresponding place on the critical line. And since theta was defined so as to give precisely this property, Z is a real even function of the real variable ''t''.
<math>\displaystyle
F_s(x)
= \mathrm{Re} \left( \sum_{n=2}^\infty \frac{\Lambda(n)}{\ln n} \frac{n^{- \frac{2 \pi i}{\ln 2} x}}{n^s} \right)
= \mathrm{Re} \left( \ln \zeta \left(s + \frac{2 \pi i}{\ln 2}x \right) \right)
</math>


Using the [http://functions.wolfram.com/webMathematica/FunctionPlotting.jsp?name=RiemannSiegelZ online plotter] we can plot Z in the regions corresponding to scale divisions, using the conversion factor {{nowrap|''t'' {{=}} {{sfrac|2π|ln(2)}}''x''}}, for ''x'' a number near or at an edo number. Hence, for instance, to plot 12 plot around 108.777, to plot 31 plot around 281.006, and so forth. An alternative plotter is the applet [http://web.viu.ca/pughg/RiemannZeta/RiemannZetaLong.html here].
If we take exponentials of both sides, then


If you have access to {{w|Mathematica}}, which has Z, zeta and theta as a part of its suite of initially defined functions, you can do even better. Below is a Mathematica-generated plot of Z({{frac|2π''x''|ln(2)}}) in the region around 12edo:
<math>\displaystyle \exp(F_s(x)) = \left| \zeta\left(s + \frac{2 \pi i}{\ln 2}x\right) \right|</math>


[[File:plot12.png|alt=plot12.png|plot12.png]]
so that we see that the absolute value of the zeta function serves to measure the relative error of an equal division.


The peak around 12 is both higher and wider than the local maximums above 11 and 13, indicating its superiority as an edo. Note also that the peak occurs at a point slightly larger than 12; this indicates the octave is slightly compressed in the zeta tuning for 12. The size of a step in octaves is 1/''x'', and hence the size of the octave in the zeta peak value tuning for ''N''edo is ''N''/''x''; if ''x'' is slightly larger than ''N'' as here with {{nowrap|''N'' {{=}} 12}}, the size of the zeta tuned octave will be slightly less than a pure octave. Similarly, when the peak occurs with ''x'' less than ''N'', we have stretched octaves.
There is an open question as to whether the analytic continuation preserves the properties we are interested in, though empirically it seems to. However, if you do not want to trust the analytic continuation, then the {{nowrap| ''s'' {{=}} 1 }} line is of interest for the reasons discussed, as though the infinite sum does not converge, every sum for {{nowrap| ''s'' > 1 }} ''does'' converge, so that we can consider the line at {{nowrap| ''s'' {{=}} 1 }} as being the "limit" as ''s'' approaches 1 from above. This can also be used to sanity-check results at {{nowrap| ''s'' {{=}} 1/2 }} by seeing where they agree, e.g. as done in the section on [[#Absolute zeta peak edos]], which looks at getting more practical tuning information out of the zeta function via an adjustment for considering absolute mistuning rather than relative error.
 
For larger edos, the width of the peak narrows, but for strong edos the height more than compensates, measured in terms of the area under the peak (the absolute value of the integral of Z between two zeros.) Note how 270 completely dominates its neighbors:
 
[[File:plot270.png|alt=plot270.png|plot270.png]]
 
Note that for one of its neighbors, 271, it isn't entirely clear which peak value corresponds to the line of real values from +∞. This can be determined by looking at the absolute value of zeta along other ''s'' values, such as {{nowrap|''s'' {{=}} 1}} or {{nowrap|''s'' {{=}} {{sfrac|3|4}}}}, and in this case the local minimum at 271.069 is the value in question. However, other peak values are not without their interest; the local maximum at 270.941, for instance, is associated to a different mapping for 3.
 
To generate this plot using the free version of Wolfram Cloud, you can run <code>Plot[Abs[RiemannSiegelZ[9.06472028x]], {x, 11.9, 12.1}]</code> and then in the menu select '''Evaluation &gt; Evaluate Cells'''. Change "'''11.9'''" and "'''12.1'''" to whatever values you want, e.g. to view the curve around 15edo you might use the values "'''14.9'''" and "'''15.1'''".
 
You can also view the plot using [https://www.desmos.com/calculator/dstp7wnidf Zeta in Desmos].


== Mike Battaglia's expanded results ==
== Mike Battaglia's expanded results ==
Line 157: Line 156:
\zeta(s) = \sum_n n^{-s}</math>
\zeta(s) = \sum_n n^{-s}</math>


Now let's do two things: we're going to expand {{nowrap|''s'' {{=}} σ + ''it''}}, and we're going to multiply ζ(s) by its conjugate ζ(''s''), noting that {{nowrap|ζ(''s'')′ {{=}} ζ(''s''′)}} and {{nowrap|ζ(''s'') ⋅ ζ(''s''){{=}} ζ(''s'')<sup>2</sup>}}. We get:
Now let's do two things: we're going to expand {{nowrap|''s'' {{=}} σ + ''it''}}, and we're going to multiply <math>\zeta(s)</math> by its complex conjugate <math>\overline{\zeta(s)}</math>, noting that <math>\overline{\zeta(s)}=\zeta(\overline{s})</math> and <math>\left| \zeta(s) \right|^{2} = \zeta(s)\overline{\zeta(s)}</math>.
We get:


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \left[\sum_n n^{-(\sigma+it)}\right] \cdot \left[\sum_d d^{-(\sigma-it)}\right]</math>
\left| \zeta(s) \right| ^2 = \left[\sum_n n^{-(\sigma+it)}\right] \cdot \left[\sum_d d^{-(\sigma-it)}\right]</math>


where d is a new variable used internally in the second summation.
where d is a new variable used internally in the second summation.
Line 167: Line 167:


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \sum_{n,d} \left[n^{-(\sigma+it)} \cdot d^{-(\sigma-it)}\right] = \sum_{n,d} \frac{\left({\tfrac{n}{d}}\right)^{-it}}{(nd)^{\sigma}}</math>
\left| \zeta(s) \right|^2 = \sum_{n,d} \left[n^{-(\sigma+it)} \cdot d^{-(\sigma-it)}\right] = \sum_{n,d} \frac{\left({\tfrac{n}{d}}\right)^{-it}}{(nd)^{\sigma}}</math>


<span style="line-height: 1.5;">Now let's do a bit of algebra with the exponential function, and use Euler's identity:</span>
<span style="line-height: 1.5;">Now let's do a bit of algebra with the exponential function, and use Euler's identity:</span>


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \sum_{n,d} \frac{e^{-it \ln\left({\tfrac{n}{d}}\right)}}{(nd)^{\sigma}}
\left| \zeta(s) \right|^2 = \sum_{n,d} \frac{e^{-it \ln\left({\tfrac{n}{d}}\right)}}{(nd)^{\sigma}}
= \sum_{n,d} \frac{\cos\left(-t \ln\left({\tfrac{n}{d}}\right)\right) + i\sin\left(-t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}}
= \sum_{n,d} \frac{\cos\left(-t \ln\left({\tfrac{n}{d}}\right)\right) + i\sin\left(-t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}}
= \sum_{n,d} \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}}</math>
= \sum_{n,d} \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}}</math>
Line 181: Line 181:


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \sum_{n=d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\left| \zeta(s) \right|^2 = \sum_{n=d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\sum_{n>d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\sum_{n>d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\sum_{n< d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right]</math>
\sum_{n< d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right]</math>
Line 187: Line 187:
We'll deal with each of these separately.
We'll deal with each of these separately.


First, in the leftmost summation, we can see that {{nowrap|''n'' {{=}} ''d''}} implies {{nowrap|ln({{frac|''n''|''d''}}) {{=}} 0}}. Since {{nowrap|sin(0) {{=}} 0}}, the sin term in the numerator cancels out, yielding:
First, in the leftmost summation, we can see that {{nowrap|''n'' {{=}} ''d''}} implies {{nowrap|ln{{pars|{{sfrac|''n''|''d''}}|1.8}} {{=}} 0}}. Since {{nowrap|sin(0) {{=}} 0}}, the sin term in the numerator cancels out, yielding:


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \sum_{n=d} \left[ \frac{\cos\left( t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\left| \zeta(s) \right|^2 = \sum_{n=d} \left[ \frac{\cos\left( t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\sum_{n>d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\sum_{n>d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\sum_{n< d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right]</math>
\sum_{n< d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right) - i\sin\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right]</math>
Line 202: Line 202:
\frac{\cos\left(t \ln\left({\tfrac{q}{p}}\right)\right) - i\sin\left(t \ln\left({\tfrac{q}{p}}\right)\right)}{(pq)^{\sigma}}</math>
\frac{\cos\left(t \ln\left({\tfrac{q}{p}}\right)\right) - i\sin\left(t \ln\left({\tfrac{q}{p}}\right)\right)}{(pq)^{\sigma}}</math>


Now, noting that {{nowrap|ln({{frac|''p''|''q''}}) {{=}} −ln({{frac|''q''|''p''}})}} and that sin is an odd function, we can see that the sin terms cancel out, leaving
Now, noting that {{nowrap|ln{{pars|{{sfrac|''p''|''q''}}|1.8}} {{=}} −ln{{pars|{{sfrac|''q''|''p''}}|1.8}}}} and that sin is an odd function, we can see that the sin terms cancel out, leaving


<math> \displaystyle
<math> \displaystyle
Line 211: Line 211:


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \sum_{n=d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\left| \zeta(s) \right|^2 = \sum_{n=d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\sum_{n>d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\sum_{n>d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right] +
\sum_{n< d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right]</math>
\sum_{n< d} \left[ \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}} \right]</math>
Line 218: Line 218:


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \sum_{n,d} \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}}</math>
\left| \zeta(s) \right|^2 = \sum_{n,d} \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}}</math>


Finally, by making the mysterious substitution {{nowrap|''t'' {{=}} {{sfrac|2π|ln(2)}}''x''}}, the musical implications of the above will start to reveal themselves:
Finally, by making the mysterious substitution {{nowrap|''t'' {{=}} {{sfrac|2π|ln(2)}}''x''}}, the musical implications of the above will start to reveal themselves:


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \sum_{n,d} \frac{\cos\left(2\pi x \log_2\left(\tfrac{n}{d}\right)\right)}{(nd)^{\sigma}}</math>
\left| \zeta(s) \right|^2 = \sum_{n,d} \frac{\cos\left(2\pi x \log_2\left(\tfrac{n}{d}\right)\right)}{(nd)^{\sigma}}</math>


Let's take a breather and see what we've got.
Let's take a breather and see what we've got.


=== Interpretation of results: "cosine relative error" ===
=== Interpretation of results: "cosine relative error" ===
For every strictly positive rational ''n''/''d'', there is a cosine with period {{nowrap|log<sub>2</sub>({{frac|''n''|''d''}})}}. This cosine peaks at {{nowrap|''x'' {{=}} {{sfrac|''N''|log<sub>2</sub>(''n''/''d'')}}}} for all integers ''N'', or in other words, the Nth-equal division of the rational number {{frac|''n''|''d''}}, and hits troughs midway between.
For every strictly positive rational ''n''/''d'', there is a cosine with period {{nowrap|log<sub>2</sub>{{pars|{{sfrac|''n''|''d''}}|1.8}}}}. This cosine peaks at {{nowrap|''x'' {{=}} {{sfrac|''N''|log<sub>2</sub>(''n''/''d'')}}}} for all integers ''N'', or in other words, the Nth-equal division of the rational number {{frac|''n''|''d''}}, and hits troughs midway between.


Our mysterious substitution above was chosen to set the units for this up nicely. The variable x now happens to be measured in divisions of the octave. (The original variable ''t'', which was the imaginary part of the zeta argument ''s'', can be thought of as the number of divisions of the interval {{nowrap|''e''<sup>2π</sup> ≈ 535.49}}, or what [[Keenan_Pepper|Keenan Pepper]] has called the "natural interval.")
Our mysterious substitution above was chosen to set the units for this up nicely. The variable x now happens to be measured in divisions of the octave. (The original variable ''t'', which was the imaginary part of the zeta argument ''s'', can be thought of as the number of divisions of the interval {{nowrap|''e''<sup>2π</sup> ≈ 535.49}}, or what [[Keenan_Pepper|Keenan Pepper]] has called the "[[zetave|natural interval]].")


As mentioned in Gene's original zeta derivation, these cosine functions can be thought of as good approximations to the terms in the TE error computation, which are all the squared errors for the different primes. Rather than taking the square of the error, we instead put the error through the function {{sfrac|1 − cos(''x'')|2}}, which is "close enough" for small values of ''x''. Since we are always rounding off to the best mapping, this error is never more 0.5 steps of the edo, so since we have {{nowrap|−0.5 &lt; x &lt; 0.5}} we have a decent enough approximation.
As mentioned in Gene's original zeta derivation, these cosine functions can be thought of as good approximations to the terms in the TE error computation, which are all the squared errors for the different primes. Rather than taking the square of the error, we instead put the error through the function {{sfrac|1 − cos(''x'')|2}}, which is "close enough" for small values of ''x''. Since we are always rounding off to the best mapping, this error is never more 0.5 steps of the edo, so since we have {{nowrap|−0.5 &lt; x &lt; 0.5}} we have a decent enough approximation.
Line 267: Line 267:


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \sum_{n,d} \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}}</math>
\left| \zeta(s) \right|^2 = \sum_{n,d} \frac{\cos\left(t \ln\left({\tfrac{n}{d}}\right)\right)}{(nd)^{\sigma}}</math>


Note that since there's no restriction that n and d be coprime, the "rationals" we're using here don't have to be reduced. So this shows that zeta yields an error metric over all unreduced rationals, but leaves open the question of how reduced rationals are handled. It turns out that the same function also measures the error of reduced rationals, scaled only by a rolloff-dependent constant factor across all edos.
Note that since there's no restriction that n and d be coprime, the "rationals" we're using here don't have to be reduced. So this shows that zeta yields an error metric over all unreduced rationals, but leaves open the question of how reduced rationals are handled. It turns out that the same function also measures the error of reduced rationals, scaled only by a rolloff-dependent constant factor across all edos.
Line 276: Line 276:


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \sum_{n',d',c} \frac{\cos\left(t \ln\left({\tfrac{cn'}{cd'}}\right)\right)}{(cn' \cdot cd')^{\sigma}}</math>
\left| \zeta(s) \right|^2 = \sum_{n',d',c} \frac{\cos\left(t \ln\left({\tfrac{cn'}{cd'}}\right)\right)}{(cn' \cdot cd')^{\sigma}}</math>


Now, the common factor {{sfrac|''c''|''c''}} cancels out inside the log in the numerator. However, in the denominator, we get an extra factor of ''c''<sup>2</sup> to contend with. This yields
Now, the common factor {{sfrac|''c''|''c''}} cancels out inside the log in the numerator. However, in the denominator, we get an extra factor of ''c''<sup>2</sup> to contend with. This yields


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \sum_{n',d',c} \frac{\cos\left(t \ln\left({\tfrac{n'}{d'}}\right)\right)}{(c^2 \cdot n'd')^{\sigma}}
\left| \zeta(s) \right|^2 = \sum_{n',d',c} \frac{\cos\left(t \ln\left({\tfrac{n'}{d'}}\right)\right)}{(c^2 \cdot n'd')^{\sigma}}
= \sum_{n',d',c} \left[ \frac{1}{c^{2\sigma}} \cdot \frac{\cos\left(t \ln\left({\tfrac{n'}{d'}}\right)\right)}{(n'd')^{\sigma}} \right]</math>
= \sum_{n',d',c} \left[ \frac{1}{c^{2\sigma}} \cdot \frac{\cos\left(t \ln\left({\tfrac{n'}{d'}}\right)\right)}{(n'd')^{\sigma}} \right]</math>


Line 287: Line 287:


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \left[ \sum_c \frac{1}{c^{2\sigma}} \right] \cdot \left[ \sum_{n',d'} \frac{\cos\left(t \ln\left({\tfrac{n'}{d'}}\right)\right)}{(n'd')^{\sigma}} \right]</math>
\left| \zeta(s) \right|^2 = \left[ \sum_c \frac{1}{c^{2\sigma}} \right] \cdot \left[ \sum_{n',d'} \frac{\cos\left(t \ln\left({\tfrac{n'}{d'}}\right)\right)}{(n'd')^{\sigma}} \right]</math>


Finally, we note that on the left summation we simply have another zeta series, yielding
Finally, we note that on the left summation we simply have another zeta series, yielding


<math> \displaystyle
<math> \displaystyle
\abs{ \zeta(s) }^2 = \zeta(2\sigma) \cdot \left[ \sum_{n',d'} \frac{\cos\left(t \ln\left({\tfrac{n'}{d'}}\right)\right)}{(n'd')^{\sigma}} \right]</math>
\left| \zeta(s) \right|^2 = \zeta(2\sigma) \cdot \left[ \sum_{n',d'} \frac{\cos\left(t \ln\left({\tfrac{n'}{d'}}\right)\right)}{(n'd')^{\sigma}} \right]</math>


<math> \displaystyle
<math> \displaystyle
\frac{\abs{ \zeta(s) }^2}{\zeta(2\sigma)} = \sum_{n',d'} \frac{\cos\left(t \ln\left({\tfrac{n'}{d'}}\right)\right)}{(n'd')^{\sigma}}</math>
\frac{\left| \zeta(s) \right|^2}{\zeta(2\sigma)} = \sum_{n',d'} \frac{\cos\left(t \ln\left({\tfrac{n'}{d'}}\right)\right)}{(n'd')^{\sigma}}</math>


Now, since we're fixing σ and letting ''t'' vary, the left zeta term is constant for all edos. This demonstrates that the zeta function also measures cosine error over all the reduced rationals, up to a constant factor. QED.
Now, since we're fixing σ and letting ''t'' vary, the left zeta term is constant for all edos. This demonstrates that the zeta function also measures cosine error over all the reduced rationals, up to a constant factor. QED.
Line 302: Line 302:
So far we have shown the following:
So far we have shown the following:


* Error on prime powers: <math>\log\,\abs{\zeta(\sigma + it)}</math>
* Error on prime powers: <math>\log\,\left| \zeta(\sigma+it) \right|</math>
* Error on unreduced rationals: <math>\abs{\zeta(\sigma+it)}^2</math>
* Error on unreduced rationals: <math>\left| \zeta(\sigma+it) \right|^2</math>
* Error on reduced rationals: <math>\frac{\abs{\zeta(\sigma+it)}^2}{\zeta(2\sigma)}</math>
* Error on reduced rationals: <math>\frac{\left| \zeta(\sigma+it) \right|^2}{\zeta(2\sigma)}</math>


Since the second is a simple monotonic transformation of the first, we can see that the same function basically measures both the relative error on just the prime powers, and also on all unreduced rationals, at least in the sense that edos will be ranked identically by both measures. The third function is really just the second function divided by a constant, since we only really care about letting <math>t</math> vary—we instead typically set <math>\sigma</math> to some value which represents the weighting "rolloff" on rationals. So, all three of these functions will rank edos identically.
Since the second is a simple monotonic transformation of the first, we can see that the same function basically measures both the relative error on just the prime powers, and also on all unreduced rationals, at least in the sense that edos will be ranked identically by both measures. The third function is really just the second function divided by a constant, since we only really care about letting <math>t</math> vary—we instead typically set <math>\sigma</math> to some value which represents the weighting "rolloff" on rationals. So, all three of these functions will rank edos identically.
Line 312: Line 312:
It turns out that using the same principles of derivation above, we can also derive another expression, this time for the relative error on only the harmonics—i.e. those intervals of the form <math>1/1, 2/1, 3/1, ... n/1, ...</math>. This was studied in a paper by Peter Buch called [[:File:Zetamusic5.pdf|"Favored cardinalities of scales"]]. The expression is:
It turns out that using the same principles of derivation above, we can also derive another expression, this time for the relative error on only the harmonics—i.e. those intervals of the form <math>1/1, 2/1, 3/1, ... n/1, ...</math>. This was studied in a paper by Peter Buch called [[:File:Zetamusic5.pdf|"Favored cardinalities of scales"]]. The expression is:


Error on harmonics only: <math>\abs{\textbf{Re}\left[\zeta(\sigma + it)\right]}</math>
Error on harmonics only: <math>\mathrm{Re}\left(\zeta(\sigma + it)\right)</math>


Note that, although the last four expressions were all monotonic transformations of one another, this one is not—this is the 'real part' of the zeta function, whereas the others were all some simple monotonic function of the 'absolute value' of the zeta function. The results, however, are  very similar—in particular, the peaks are approximately to one another, shifted by only a small amount (at least for reasonably-sized edos up to a few hundred).
Note that, although the last four expressions were all monotonic transformations of one another, this one is not—this is the 'real part' of the zeta function, whereas the others were all some simple monotonic function of the 'absolute value' of the zeta function. The results, however, are  very similar—in particular, the peaks are approximately to one another, shifted by only a small amount (at least for reasonably-sized edos up to a few hundred).
Line 319: Line 319:
The expression
The expression


<math>\displaystyle{\abs{\zeta\left(\frac{1}{2} + it\right)}^2 \cdot \overline {\phi(t)}}</math>
<math>\displaystyle{\left| \zeta\left(\frac{1}{2} + it\right) \right|^2 \cdot \overline {\phi(t)}}</math>


is, up to a flip in sign, the Fourier transform of the unnormalized Harmonic Shannon Entropy for {{nowrap|''N'' {{=}} &infin;}}, where φ(''t'') is the characteristic function (aka Fourier transform) of the spreading distribution and {{overline|φ(''t'')}} denotes complex conjugation.
is, up to a flip in sign, the Fourier transform of the unnormalized Harmonic Shannon Entropy for {{nowrap|''N'' {{=}} &infin;}}, where φ(''t'') is the characteristic function (aka Fourier transform) of the spreading distribution and {{overline|φ(''t'')}} denotes complex conjugation.
Line 326: Line 326:


More can be found at the page on [[Harmonic entropy#Extending_HE_to_.5Bmath.5DN.3D.5Cinfty.5B.2Fmath.5D:_zeta-HE|harmonic entropy]], including a generalization to Renyi entropy for arbitrary <math>a</math>.
More can be found at the page on [[Harmonic entropy#Extending_HE_to_.5Bmath.5DN.3D.5Cinfty.5B.2Fmath.5D:_zeta-HE|harmonic entropy]], including a generalization to Renyi entropy for arbitrary <math>a</math>.
== The matter of sigma: the critical strip, zeta peaks, and Gram points ==
So long as {{nowrap|''s'' &ge; 1}}, the absolute value of the zeta function can be seen as a relative error measurement. However, the rationale for that view of things departs when {{nowrap|''s'' &lt; 1}}, particularly in the [http://mathworld.wolfram.com/CriticalStrip.html critical strip], when {{nowrap|0 &lt; ''s'' &lt; 1}}. As s approaches the value {{nowrap|''s'' {{=}} {{sfrac|1|2}}}} of the [http://mathworld.wolfram.com/CriticalLine.html critical line], the "information content" of the zeta function concerning higher primes increases and it behaves increasingly like a badness measure (or more correctly, since we have inverted it, like a goodness measure.) The quasi-symmetric [https://planetmath.org/encyclopedia/FunctionalEquationOfTheRiemannZetaFunction.html functional equation] of the zeta function tells us that past the critical line the information content starts to decrease again, with {{nowrap|1 − ''s''}} and ''s'' having the same information content; that is, for ''s'' > {{sfrac|1|2}}, {{nowrap|1 − ''s''}} essentially multiplies the zeta function at ''s'' by a fixed, monotonic increasing function. Hence it is the zeta function between {{nowrap|''s'' {{=}} {{sfrac|1|2}}}} and {{nowrap|''s'' {{=}} 1}}, and especially the zeta function along the critical line {{nowrap|''s'' {{=}} {{sfrac|1|2}}}}, which is of the most interest.
=== Introduction to Gram points ===
As {{nowrap|''s'' &gt; 1}} gets larger, the Dirichlet series for the zeta function is increasingly dominated by the 2 term, getting ever closer to simply {{nowrap|1 + 2<sup>−''z''</sup>}}, which approaches 1 as {{nowrap|''s'' {{=}} Re(''z'')}} becomes larger. When {{nowrap|''s'' ≫ 1}} and ''x'' is an integer, the real part of zeta is approximately {{nowrap|1 + 2<sup>−''s''</sup>}}, and the imaginary part is approximately zero; that is, zeta is approximately real. Starting from {{nowrap|''s'' {{=}} +&infin;}} with ''x'' an integer, we can trace a line back towards the critical strip on which zeta is real. Since when {{nowrap|''s'' ≫ 1}} the derivative is approximately −{{sfrac|ln(2)|2<sup>''s''</sup>}}, it is negative on this line of real values for zeta, meaning that the real value for zeta increases as ''s'' decreases. The zeta function approaches 1 uniformly as ''s'' increases to infinity, so as ''s'' decreases, the real-valued zeta function along this line of real values continues to increase though all real values from 1 to infinity monotonically. When it crosses the critical line where {{nowrap|''s'' {{=}} {{sfrac|1|2}}}}, it produces a real value of zeta on the critical line. Points on the critical line where {{nowrap|ζ({{frac|1|2}} + ''ig'')}} are real are called "Gram points", after {{w|Jørgen Pedersen Gram}}. We thus have associated pure-octave edos, where ''x'' is an integer, to a value near to the pure octave, at the special sorts of Gram points which corresponds to edos.
=== Gram points and zeta peaks ===
Because the value of zeta increased continuously as it made its way from +&infin; to the critical line, we might expect the values of zeta at these special Gram points to be relatively large. This would be especially true if −ζ′(''z'') is getting a boost from other small primes as it travels toward the Gram point. A complex formula due to {{w|Bernhard Riemann}} which he failed to publish because it was so nasty becomes a bit simpler when used at a Gram point. It is named the {{w|Riemann–Siegel formula}} since {{w|Carl Ludwig Siegel}} went looking for it and was able to reconstruct it after rooting industriously around in Riemann's unpublished papers. From this formula, it is apparent that when x corresponds to a good edo, the value of {{nowrap|ζ({{frac|1|2}} + ''ig'')}} at the corresponding Gram point should be especially large.
=== The Z function: a mathematically convenient version of zeta ===
The absolute value of {{nowrap|ζ{{pars|{{sfrac|1|2}} + ''ig''}}|1.8}} at a Gram point corresponding to an edo is near to a local maximum, but not actually at one. At the local maximum, of course, the partial derivative of {{nowrap|ζ{{pars|{{sfrac|1|2}} + ''it''}}|1.8}} with respect to ''t'' will be zero; however this does not mean its derivative there will be zero. In fact, the {{w|Riemann hypothesis}} is equivalent to the claim that all zeros of {{nowrap|ζ′(''s'' + ''it'')}} occur when {{nowrap|''s'' &gt; {{sfrac|1|2}}}}, which is where all known zeros lie. These do not have values of ''t'' corresponding to good edos. For this and other reasons, it is helpful to have a function which is real for values on the critical line but whose absolute value is the same as that of zeta. This is provided by the {{w|''Z'' function}}, which is defined (in terms of the {{subpage|appendix|u|s=Z function and Riemann-Siegel theta function|text=Riemann-Siegel theta function}}) as:
<math>Z(t) = \exp(i \theta(t)) \zeta\left(\frac{1}{2} + it\right)</math>.
The factor of <math>\exp(i \theta(t))</math> simply modifies zeta by a complex phase, and so the absolute value of Z along the real axis is the same as the absolute value of ζ at the corresponding place on the critical line, and the zeros of Z in this strip correspond one to one with the zeros of ζ in the critical strip, and since θ is holomorphic on the strip with imaginary part between −{{sfrac|1|2}} and {{sfrac|1|2}}, so is Z. And Z is a real even function of the real variable ''t'', since theta was defined so as to give precisely this property.


== Zeta edo lists ==
== Zeta edo lists ==
Line 336: Line 352:
==== Zeta peak integer edos ====
==== Zeta peak integer edos ====
Alternatively (as [[groundfault]] has found), if we do not allow octave detuning and instead look at only the record {{nowrap|{{abs|Z(''x'')}}}} zeta scores corresponding to exact edos with pure octaves, we get {{EDOs| 1, 2, 3, 5, 7, 10, 12, 19, 22, 31, 41, 53, 87, 118, 130, 171, 224, 270, 311, 472, 494, 742, 1065, 1106, 1395, 1578, 2460, 2684, 3566, 4231, 4973, 5585, 8269, 8539, 14124, 14348, 16808, 28742, 30631, 34691, 36269, 57578, 58973,}} … of '''zeta peak integer edos'''. Edos not present in the previous list but present here include {{EDOs| 87, 311, 472, 1065, 3566, 4231, 4973, 14124, 30631,}} … and edos present in the previous list but not present here include {{EDOs| 4, 27, 72, 99, 152, 217, 342, 422, 441, 764, 935, 954, 1012, 1178, 1236, 1448, 3395, 6079, 7033, 11664,}} … with 72's removal perhaps being the most surprising, showing the strength of 53 in that 72 does not improve on 53's peak. This definition may be better for measuring how accurate edos are without detuned octaves, whereas the previous list assumes that the octave is tempered along with all other intervals. This list can thus also be thought of as "pure-octave zeta peak edos."
Alternatively (as [[groundfault]] has found), if we do not allow octave detuning and instead look at only the record {{nowrap|{{abs|Z(''x'')}}}} zeta scores corresponding to exact edos with pure octaves, we get {{EDOs| 1, 2, 3, 5, 7, 10, 12, 19, 22, 31, 41, 53, 87, 118, 130, 171, 224, 270, 311, 472, 494, 742, 1065, 1106, 1395, 1578, 2460, 2684, 3566, 4231, 4973, 5585, 8269, 8539, 14124, 14348, 16808, 28742, 30631, 34691, 36269, 57578, 58973,}} … of '''zeta peak integer edos'''. Edos not present in the previous list but present here include {{EDOs| 87, 311, 472, 1065, 3566, 4231, 4973, 14124, 30631,}} … and edos present in the previous list but not present here include {{EDOs| 4, 27, 72, 99, 152, 217, 342, 422, 441, 764, 935, 954, 1012, 1178, 1236, 1448, 3395, 6079, 7033, 11664,}} … with 72's removal perhaps being the most surprising, showing the strength of 53 in that 72 does not improve on 53's peak. This definition may be better for measuring how accurate edos are without detuned octaves, whereas the previous list assumes that the octave is tempered along with all other intervals. This list can thus also be thought of as "pure-octave zeta peak edos."
==== Absolute zeta peak edos ====
If we consider that zeta is a measure of relative error (that is, error measured relative to the step size), we realize that plenty of equal temperaments* are excluded simply because, though practically speaking they have great tuning properties, they are not as "efficient" with their number of tones as the last record peak. Arguably what we're interested in is a sequence of edos that generally do increasingly better at tuning JI in terms of lowering the average cent error. Therefore, it suffices to multiply the score by the size of the equal temperament. Surprisingly, the list for ''s'' = 1/2 — which is supposedly where high-limit information is maximized — is ''almost identical'' to the one for ''s'' = 1 — which is the smallest value of ''s'' that we can assume to be meaningful without assuming that the analytic continuation preserves the tuning properties we are interested in — so that we have reassurance from the ''s'' = 1 list that the ''s'' = 1/2 list is meaningful wherever they agree. This is important because surprisingly, the two lists of equal temperament are ''identical up to [[311edo|311et]]'', with only one edo, [[8edo]], omitted from the list for ''s'' = 1. This list is {{EDOs| 1, 2, 3, 4, 5, 7, 9, 10, 12, 14, 15, 17, 19, 22, 24, 26, 27, 31, 34, 41, 46, 53, 58, 65, 68, 72, 84, 87, 94, 99, 111, 118, 130, 140, 152, 171, 183, 198, 212, 217, 224, 243, 270, 311, ... }}.
<nowiki>*</nowiki> Note importantly that we speak of "equal temperaments" rather than "edos" because generally a record peak ''does not'' correspond to an edo, which can have tangible consequences (a significant example is discussed in the next section).
===== Extended list of absolute zeta peak edos =====
If you look at the graph of zeta (for any zeta graph of interest), another issue quickly becomes evident: many equal temperaments of interest fail to have peaks of record height by only small amounts, so that we intuitively want to include them in a more comprehensive list. However, trying to "fix" this issue quickly leads into another issue: how many "nearly record" edos should we include, and why? The smallest alteration we can make is to allow an equal temperament that does better than the second-best-scoring equal temperament so far. But sometimes we have two very strong equal temperaments appear in quick succession, and given the motivation is to find a more comprehensive list anyways, here we'll include any equal temperament that does better than the third-best-scoring equal temperament so far. The motivation for this cutoff is that you intuitively might expect that the three best equal temperaments found so far represent roughly how good we can do in a given range of step sizes, so that they define what is "normal" for that range, that is, it's the heuristic of the "rule of three". Again, the list for ''s'' = 1/2 is almost identical to ''s'' = 1 for equal temperaments up to 311et, though this time the differences are less trivial: [[176edo|176et]] and [[202edo|202et]] only appear for ''s'' = 1/2, so are put in brackets. The list is {{EDOs| 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 22, 24, 26, 27, 29, 31, 34, 36, 38, 39*, 41, 43, 45, 46, 48, 50, 53, 56, 58, 60, 63, 65, 68, 72, 77, 80, 84, 87, 89, 94, 96, 99, 103, 106, 111, 113, 118, 121, 125, 130, 137, 140, 145, 149, 152, 159, 161, 166, 171, (176,) 183, 190, 193, 198, (202,) 212, 217, 224, 229, 239, 243, 248, 255, 270, 277, 282, 289, 301, 311, ... }}.
The equal temperaments added relative to the non-extended list of only things that are records proper are: {{EDOs| 6, 8, 11, 13, 16, 21, 29, 36, 38, 39*, 43, 45, 48, 50, 56, 60, 63, 77, 80, 89, 96, 103, 106, 113, 121, 125, 137, 145, 149, 159, 161, 166, (176,) 190, 193, (202,) 229, 239, 248, 255, 277, 282, 289, 301 }}. * 39et is a notable example because [[39edo]] corresponds to a zeta valley, so it's surprising that it would be included here; the reason that it is included is because this is ''not'' 39edo, but 39 ''equal temperament'', corresponding to a 3.8{{cent}} flat-tempered octave so that it is actually ~39.124edo, that is, it corresponds to the 173rd zeta peak, known by the shorthand 173zpi (where i stands for index). Therefore, this may prove a good testcase for investigating the effects of zeta-based octave-tempering, though given the size of the stretch, the difference is likely to be subtle, but the fact that it "changes zeta's mind" this much is itself interesting. You can also interpret this result differently, which is as evidence that you should not include equal temperaments worse than the third-best-scoring equal temperament so far, given the somewhat dubious inclusion of 39et, however it should be noted that this is more to do with that at the very beginning of the list there aren't many equal temperaments to "beat" so that beating the third-best-scoring equal temperament so far is easy, though arguably this isn't a flaw because people are often more likely to try a smaller equal temperament. It's also perhaps worth noting that 37et almost makes this extended list, but the omission of 37et is much better addressed by no-3's zeta.


==== Zeta integral edos ====
==== Zeta integral edos ====
Line 389: Line 415:
| [[954edo|954]]  
| [[954edo|954]]  
|-
|-
! rowspan="2" | Zeta<br>peak !! Detuned<br>octaves
! rowspan="2" | Record<br>peak !! Detuned<br>octaves
| &#x2605;
| &#x2605;
| &#x2605;
| &#x2605;
Line 463: Line 489:
|  
|  
|-
|-
! colspan="2" | Zeta integral
! colspan="2" | Integral
|
|
| &#x2605;
| &#x2605;
Line 500: Line 526:
| &#x2605;  
| &#x2605;  
|-
|-
! colspan="2" | Zeta gap
! colspan="2" | Gap
|
|
| &#x2605;
| &#x2605;
Line 540: Line 566:
=== Anti-record edos ===
=== Anti-record edos ===
==== Zeta valley edos ====
==== Zeta valley edos ====
In addition to looking at {{nowrap|{{abs|Z(x)}}}} maxima, we can also look at {{nowrap|{{abs|Z(x)}}}} ''minima'' for integer values of ''x''. These correspond to ''zeta valley edos'', and we get a list of edos {{EDOs| 1, 8, 18, 39, 55, 64, 79, 5941, 8294,}} … These tunings tend to deviate from ''p''-limit JI as much as possible while still preserving octaves, and can serve as "more xenharmonic" tunings. Keep in mind, however, that the ''most'' xenharmonic tunings would not contain octaves at all.
In addition to looking at {{nowrap|{{abs|Z(x)}}}} maxima, we can also look at {{nowrap|{{abs|Z(x)}}}} ''minima'' for integer values of ''x''. These correspond to ''zeta valley edos'', and we get a list of edos {{EDOs| 1, 8, 18, 39, 55, 64, 79, 5941, 8294,}}… Zeta valley EDOs can be thought of as pure-octave tunings that tend to deviate from ''p''-limit JI as much as possible while still preserving octaves, and can serve as "more xenharmonic" tunings. Zeta valley EDOs are only measured with pure octaves, since "tempered-octave zeta valley edos" would simply be any zero of Z(x). Keep in mind, however, that the ''most'' xenharmonic tunings would not contain octaves at all.


Notice the sudden jump from [[79edo]] to [[5941edo]]. We know that {{nowrap|{{abs|Z(x)}}}} grows logarithmically on average. If we assume the scores of integer edos are uniformly distributed on the interval {{nowrap|[0, ''c'' log(''x'')]}}, the probability for the next edo to have a zeta score less than a given small value is also very small, so we would expect valley edos to be rarer than peak edos. So, it would be more productive to find edos which zeta score is simply less than a given threshold.
Notice that there is a very large jump from [[79edo]] to [[5941edo]]. We know that record {{nowrap|{{abs|Z(x)}}}} scores, both with tempered octaves and pure octaves, grow logarithmically on average. If we assume the scores of integer edos are uniformly distributed on the interval {{nowrap|[0, ''c'' log(''x'')]}}, the probability for the next edo to have a zeta score less than a given small value is also very small, so we would expect valley edos to be rarer than peak edos. So, it would be more productive to find edos which zeta score is simply less than a given threshold.
 
Note that "tempered-octave zeta valley edos" would simply be any zero of Z(x).


=== ''k''-ary-peak edos ===
=== ''k''-ary-peak edos ===
Line 592: Line 616:


{{EDOs| 9, 14, 21, 26, 32, 39, 45, 51, 55, 62, 67, 70, 74, 79, 85, 93, 98, }} …
{{EDOs| 9, 14, 21, 26, 32, 39, 45, 51, 55, 62, 67, 70, 74, 79, 85, 93, 98, }} …
=== Further lists ===
See [[The Riemann zeta function and tuning/Record lists|the record lists]].


== Optimal octave stretch ==
== Optimal octave stretch ==
Another use for the Riemann zeta function is to determine the optimal tuning for an edo, meaning the optimal octave stretch. This is because the zeta peaks are typically not integers. The fractional part can give us the degree to which the generator diverges from what you would need to have the octave be a perfect 1200 cents.  
Another use for the Riemann zeta function is to determine the optimal tuning for an edo, meaning the optimal octave stretch. This is because the zeta peaks are typically not integers. The fractional part can give us the degree to which the generator diverges from what you would need to have the octave be a perfect 1200 cents.  


Here is a list of successively higher zeta peaks, taken to five decimal places:
For all edos 1 through 100, and for a list of successively higher zeta peaks, taken to five decimal places, see [[table of zeta-stretched edos]].
 
<pre>
    0.00000
    1.12657
    1.97277
    3.05976
    3.90445
    5.03448
    6.95669
  10.00846
  12.02318
  18.94809
  22.02515
  27.08661
  30.97838
  40.98808
  52.99683
  71.95061
  99.04733
  117.96951
  130.00391
  152.05285
  170.99589
  217.02470
  224.00255
  270.01779
  341.97485
  422.05570
  441.01827
  494.01377
  742.01093
  764.01938
  935.03297
  953.94128
1012.02423
1105.99972
1177.96567
1236.02355
1394.98350
1447.97300
1577.98315
2459.98488
2683.99168
3395.02659
5585.00172
6079.01642
7032.96529
8268.98378
8539.00834
11664.01488
14347.99444
16807.99325
28742.01019
34691.00191
36268.98775
57578.00854
58972.99326
95524.04578
102557.01877
112984.99531
148418.01630
212146.99129
241199.99851
</pre>
 
For all edos 1 through 100, see [[table of zeta-stretched edos]].


=== Zeta peak index ===
=== Zeta peak index ===
These octave-stretched edos are not the only tunings which can be produced from zeta peaks. They are only one type of tuning within a larger family of equal-step tunings called zeta peak indexes. They have their own article here, with a table of the first 500 or so: [[ZPI|zeta peak index (ZPI)]].
These octave-stretched edos are not the only tunings which can be produced from zeta peaks. They are only one type of tuning within a larger family of equal-step tunings called zeta peak indices. They have their own article here, with a table of the first 500 or so: [[ZPI|zeta peak index (ZPI)]].


== Removing primes ==
== Removing primes ==
The [http://mathworld.wolfram.com/EulerProduct.html Euler product] for the Riemann zeta function is
An [http://mathworld.wolfram.com/EulerProduct.html Euler product] formula for the Riemann zeta function {{subpage|appendix|u|s=Euler product expression for the zeta function|text=can be easily derived}}:


<math>\displaystyle{
<math>\displaystyle{
Line 674: Line 635:
}</math>
}</math>


where the product is over all primes ''p''. The product converges for values of ''s'' with real part greater than or equal to one, except for {{nowrap|''s'' {{=}} 1}} where it diverges to infinity. We may remove a finite list of primes from consideration by multiplying ζ(''s'') by the corresponding factors {{nowrap|(1 − ''p''<sup>−''s''</sup>)}} for each prime ''p'' we wish to remove. After we have done this, the smallest prime remaining will dominate peak values for ''s'' with large real part, and as before we can track these peaks backwards and, by analytical continuation, into the critical strip. In particular if we remove the prime 2, {{nowrap|(1 − 2<sup>−''s''</sup>)ζ(''s'')}} is now dominated by 3, and the large peak values occur near equal divisions of the "tritave", ie 3.
where the product is over all primes ''p''. The product converges for values of ''s'' with real part greater than one, while at {{nowrap|''s'' {{=}} 1}} it diverges to infinity. We may remove a finite list of primes from consideration by multiplying ζ(''s'') by the corresponding factors {{nowrap|(1 − ''p''<sup>−''s''</sup>)}} for each prime ''p'' we wish to remove. After we have done this, the smallest prime remaining will dominate peak values for ''s'' with large real part, and as before we can track these peaks backwards and, by analytical continuation, into the critical strip. In particular if we remove the prime 2, {{nowrap|(1 − 2<sup>−''s''</sup>)ζ(''s'')}} is now dominated by 3, and the large peak values occur near equal divisions of the "tritave", ie 3.


Along the critical line:
Along any line of constant <math>\sigma</math>, {{subpage|appendix|u|s=Conversion factor for removing primes|text=it can be shown that}}:


<math>
<math>\displaystyle{
\displaystyle\abs{1 - p^{\frac{1}{2} - it}} = \sqrt{1 + \frac{1}{p} - \frac{2 \cos(t \ln p)}{\sqrt{p}}}
\left| 1 - p^{-\sigma - it} \right| = \sqrt{1 + \frac{1}{p^{2\sigma}} - \frac{2 \cos(t \ln p)}{p^\sigma}}
</math>
}</math>;


Multiplying the Z-function by this factor of adjustment gives a Z-function with the prime ''p'' removed from consideration. Zeta peak and zeta integral tunings may then be found as before.
in particular, on the critical line,
 
Removing 2 leads to increasing adjusted peak values corresponding to edts (division of the [[3/1|{{ordinal|3}}]] harmonic, or "tritave") into {{EDTs| 4, 7, 9, 13, 15, 17, 26, 32, 39, 45, 52, 56, 71, 75, 88, 131, 245, 316,}} … parts. We can also compare zeta peak EDTs with pure and tempered tritaves just like [[#zeta peak edos|zeta peak]] edos. A striking feature of this list is the appearance not only of [[13edt]], the [[Bohlen–Pierce]] division of the tritave, but the multiples 26, 39, and 52 also.
 
=== Black magic formulas ===
When [[Gene Ward Smith|Gene Smith]] discovered these formulas in the 70s, he thought of them as "black magic" formulas not because of any aura of evil, but because they seemed mysteriously to give you something for next to nothing. They are based on Gram points and the Riemann–Siegel theta function θ(''t''). Recall that a Gram point is a point on the critical line where {{nowrap|ζ({{frac|1|2}} + ''ig'')}} is real. This implies that exp(''i''θ(''g'')) is real, so that {{frac|θ(''g'')|π}} is an integer. Theta has an {{w|asymptotic expansion}}


<math>\displaystyle{
<math>\displaystyle{
\theta(t) \sim \frac{t}{2}\log \frac{t}{2\pi} - \frac{t}{2} - \frac{\pi}{8}+\frac{1}{48t}+ \frac{7}{5760t^3}+\cdots
\left| 1 - p^{-\frac{1}{2} - it} \right| = \sqrt{1 + \frac{1}{p} - \frac{2 \cos(t \ln p)}{\sqrt{p}}}
}</math>
}</math>.


From this we may deduce that {{nowrap|{{sfrac|θ(''t'')|π}} ≈ ''r'' ln(''r'') − ''r'' − {{sfrac|1|8}}}}, where {{nowrap|''r'' {{=}} {{sfrac|''t''|2π}} {{=}} {{sfrac|''x'' ln(2)}}}}; hence while x is the number of equal steps to an octave, ''r'' is the number of equal steps to an "''e''-tave", meaning the interval of ''e'', which is {{nowrap|{{sfrac|1200|ln(2)}} {{=}} 1731.234{{cent}}}}.
Multiplying the Z-function by this factor of adjustment gives a Z-function with the prime ''p'' removed from consideration. Zeta peak and zeta integral tunings may then be found as before. Note that multiplying this factor is technically only accurate for sums whose result is related to the Z function rather than the real part of the zeta function.


Recall that Gram points near to pure-octave edos, where ''x'' is an integer, can be expected to correspond to peak values of {{nowrap|{{abs|ζ}} {{=}} {{abs|Z}}}}. We can find these Gram points by Newton's method applied to the above formula. If {{nowrap|''r'' {{=}} {{sfrac|''x''|ln(2)}}}}, and if {{nowrap|''n'' {{=}} ⌊''r'' ln(''r'') − ''r'' + {{frac|3|8}}⌋}} is the nearest integer to {{sfrac|θ(2π''r'')}}, then we may set {{nowrap|''r''<sup>+</sup> {{=}} {{sfrac|''r'' + ''n'' + {{frac|1|8}}|ln(''r'')}}}}. This is the first iteration of Newton's method, which we may repeat if we like, but in fact no more than one iteration is really required. This is the first black magic formula, giving an adjusted "Gram" tuning from the orginal one.
For example, if we want to find zeta peak [[EDT]]s (division of the [[3/1|{{ordinal|3}}]] harmonic, or "tritave")—noting that here we must substitute <math>t = \frac{2\pi x}{\ln(3)}</math> instead of <math>\frac{2\pi x}{\ln(2)}</math>—in the no-twos subgroup, our modified Z function is:


For an example, consider {{nowrap|''x'' {{=}} 12}}, so that {{nowrap|''r'' {{=}} {{sfrac|12|ln(2)}} {{=}} 17.312}}. Then {{nowrap|''r'' ln(''r'') − ''r'' − {{sfrac|1|8}} {{=}} 31.927}}, which rounded to the nearest integer is 32, so {{nowrap|''n'' {{=}} 32}}. Then {{nowrap|{{sfrac|''r'' + ''n'' + {{frac|1|8}}|ln(''r'')}} {{=}} 17.338}}, corresponding to {{nowrap|''x'' {{=}} 12.0176}}, which means a single step is 99.853 cents and the octave is tempered to twelve of these, which is 1198.238 cents.
<math>
 
\displaystyle Z\left(\frac{2\pi}{\ln(3)}x\right)\sqrt{\frac{3}{2}-\sqrt{2}\cos\left(\frac{2\pi\ln(2)}{\ln(3)}x\right)}
The fact that ''x'' is slightly greater than 12 means 12 has an overall sharp quality. We may also find this out by looking at the value we computed for {{nowrap|θ(2π''r'') / π}}, which was 31.927. Then {{nowrap|32 − 31.927 {{=}} 0.0726}}, which is positive but not too large; this is the second black magic formula, evaluating the nature of an edo ''x'' by computing {{nowrap|⌊''r'' ln(''r'') − ''r'' + {{frac|3|8}}⌋ − ''r'' ln(''r'') + ''r'' + {{frac|1|8}}}}, where {{nowrap|''r'' {{=}} {{sfrac|''x''|ln(2)}}}}. This works more often than not on the clearcut cases, but when ''x'' is extreme it may not; 49 is very sharp in tendency, for example, but this method calls it as flat; similarly it counts 45 as sharp.
</math>.


== Computing zeta ==
Removing 2 leads to increasing adjusted peak values corresponding to edts into {{EDTs| 4, 7, 9, 13, 15, 17, 26, 32, 39, 56, 69, 75, 88, 131, 245, 316,}} parts. We can also compare zeta peak EDTs with pure and tempered tritaves just like [[#zeta peak edos|zeta peak]] edos. A striking feature of this list is the appearance not only of [[13edt]], the [[Bohlen–Pierce]] division of the tritave, but the multiples 26 and 39 also.
There are various approaches to the question of computing the zeta function, but perhaps the simplest is the use of the {{w|Dirichlet eta function}} which was introduced to mathematics by {{w|Johann Peter Gustav Lejeune Dirichlet}}, who despite his name was a German and the brother-in-law of {{w|Felix Mendelssohn}}.
 
The zeta function has a [http://mathworld.wolfram.com/SimplePole.html simple pole] at {{nowrap|''z'' {{=}} 1}} which forms a barrier against continuing it with its {{w|Euler product}} or {{w|Dirichlet series}} representation. We could subtract off the pole, or multiply by a factor of {{nowrap|''z'' − 1}}, but at the expense of losing the character of a Dirichlet series or Euler product. A better method is to multiply by a factor of {{nowrap|1 − 2<sup>1&#x200A;−&#x200A;''z''</sup>}}, leading to the eta function:
 
<math>\displaystyle{\eta(z) = \left(1-2^{1-z}\right)\zeta(z) = \sum_{n=1}^\infty (-1)^{n-1} n^{-z}
= \frac{1}{1^z} - \frac{1}{2^z} + \frac{1}{3^z} - \frac{1}{4^z} + \cdots}</math>
 
The Dirichlet series for the zeta function is absolutely convergent when {{nowrap|''s'' &gt; 1}}, justifying the rearrangement of terms leading to the alternating series for eta, which converges conditionally in the critical strip. The extra factor introduces zeros of the eta function at the points {{nowrap|1 + {{sfrac|2π''i''|ln(2)}}x}} corresponding to pure octave divisions along the line {{nowrap|''s'' {{=}} 1}}, but no other zeros, and in particular none in the critical strip and along the critical line. The convergence of the alternating series can be greatly accelerated by applying {{w|Euler summation}}.


== Open problems ==
== Open problems ==
# Are there metrics similar to zeta metrics, but for edos' performance at approximating arbitrary [[delta-rational]] chords?
# Are there metrics similar to zeta metrics, but for edos' performance at approximating arbitrary [[delta-rational]] chords?
== Further information ==
* {{subpage|appendix|u|s=Black magic formulas|text=How it can be shown what ETs have a sharp vs. flat tendency}}
* {{subpage|appendix|u|s=Computing zeta|text=How do you actually compute zeta?}}


== Links ==
== Links ==