Gral method: Difference between revisions

Naren (talk | contribs)
Create page
 
Naren (talk | contribs)
Add 'Continued Fractions Without Tears' reference, gralculator link
 
(One intermediate revision by the same user not shown)
Line 87: Line 87:


The algorithm is a binary search for the number <math>g/h</math>,
The algorithm is a binary search for the number <math>g/h</math>,
starting with the interval <math>[0/1, 1/0]</math> and 'bisecting' each interval <math>[a/c, b/d]</math> with the mediant <math>(a+b)/(c+d)</math>.<ref name="knuth1994concrete"/>
starting with the interval <math>[0/1, 1/0]</math> and 'bisecting' each interval <math>[a/c, b/d]</math> with the mediant <math>(a+b)/(c+d)</math>.<ref name="knuth1994concrete"/><ref name="richards1981continued"/>
Each interval <math>[a/c, b/d]</math> we encounter in the search has <math>ad - bc = -1</math>,
Each interval <math>[a/c, b/d]</math> we encounter in the search has <math>ad - bc = -1</math>,
so <math>(a, b)</math>, <math>(c, d)</math> form a basis,
so <math>(a, b)</math>, <math>(c, d)</math> form a basis,
Line 142: Line 142:
The columns a, b, c, d give the basis <math>(a,b)</math>, <math>(c,d)</math> corresponding to the search interval <math>[a/c,b/d]</math>.
The columns a, b, c, d give the basis <math>(a,b)</math>, <math>(c,d)</math> corresponding to the search interval <math>[a/c,b/d]</math>.
The columns s and t give the resulting step sizes (for which <math>as+ bt = g</math> and <math>cs + dt = h</math>).
The columns s and t give the resulting step sizes (for which <math>as+ bt = g</math> and <math>cs + dt = h</math>).
The row with mediant 10/17, for example, tells us that we get a 17 note MOS with 12 steps of 63.90 cents and 5 steps of 86.64 cents.
The row with mediant 10/17, for example, tells us that we get a 17 note MOS with 12 steps of 63.90 cents and 5 steps of 86.64 cents.
The corresponding search interval <math>[7/12, 3/5]</math> tells us that any generator <math>g</math>
between <math>1200 \cdot 7/12 = 700</math> cents and <math>1200 \cdot 3/5 = 720</math> cents will give a 10/17 MOS.


The Gral method is a very convenient way to calculate MOS, and it was extensively used by Wilson.<ref name="wilson-temperament"/><ref name="wilson-recurrent"/>
The Gral method is a very convenient way to calculate MOS, and it was extensively used by Wilson.<ref name="wilson-temperament"/><ref name="wilson-recurrent"/>
Line 182: Line 185:
Wilson describes each basis as a different keyboard named with the mediant,
Wilson describes each basis as a different keyboard named with the mediant,
so the basis <math>(1, 3)</math>, <math>(2, 5)</math> is called the 4/7 keyboard.<ref name="wilson-gralspectrum"/><ref name="wilson-gralkeyboard"/>
so the basis <math>(1, 3)</math>, <math>(2, 5)</math> is called the 4/7 keyboard.<ref name="wilson-gralspectrum"/><ref name="wilson-gralkeyboard"/>
== Labeling the MOS ==
For a given interval <math>[a/c, b/d]</math> found by the Gral method,
we might label the corresponding MOS by either of
* The mediant <math>m/n = (a + b)/(c + d)</math>
* The step counts <math>c</math> and <math>d</math>
So for the MOS corresponding to the row with mediant 10/17 discussed above, we might call it a 10/17 MOS, or a 12<math>s</math> 5<math>t</math> MOS.
We can convert between these two labels:
* Given the mediant <math>m/n</math>, we have <math>c = m^{-1}\ (\mathrm{mod}\ n)</math> and <math>d = n - c</math>.
* Given the step counts <math>c</math> and <math>d</math>, we have <math>n = c + d</math> and <math>m = c^{-1}\ (\mathrm{mod}\ n)</math>.
Here <math>m = c^{-1}\ (\mathrm{mod}\ n)</math> means <math>m</math> is the modular inverse of <math>c</math> with respect to <math>n</math>;
in Python this is written <code>m = pow(c, -1, n)</code>.
The modular inverse comes up because <math>ad - bc = -1</math> is equivalent to <math>cm - an = 1</math>,
so <math>cm \equiv 1\ (\mathrm{mod}\ n)</math>.


== References ==
== References ==
Line 190: Line 212:
<ref name="knuth1994concrete">
<ref name="knuth1994concrete">
D.E. Knuth, O. Patashnik, and R.L. Graham, [https://seriouscomputerist.atariverse.com/media/pdf/book/Concrete%20Mathematics.pdf Concrete Mathematics]. Addison-Wesley, 1994.
D.E. Knuth, O. Patashnik, and R.L. Graham, [https://seriouscomputerist.atariverse.com/media/pdf/book/Concrete%20Mathematics.pdf Concrete Mathematics]. Addison-Wesley, 1994.
</ref>
<ref name="richards1981continued">
Ian Richards, [https://www.microsoft.com/en-us/research/wp-content/uploads/2016/10/cont-frac-wihtout-tears-richards-1.pdf Continued Fractions Without Tears]. Mathematics Magazine 54.4, 1981.
</ref>
</ref>
<ref name="wilson-temperament">
<ref name="wilson-temperament">
Line 198: Line 223:
</ref>
</ref>
<ref name="ratan2026another">
<ref name="ratan2026another">
Naren Ratan, [https://www.xenharmonikon.org/2026/05/19/another-look-at-wilsons-keyboard-mapping-system/ Another look at Wilson's keyboard mapping system], Xenharmonikon Online, 2026.
Naren Ratan, [https://www.xenharmonikon.org/2026/05/19/another-look-at-wilsons-keyboard-mapping-system/ Another look at Wilson's keyboard mapping system]. Xenharmonikon Online, 2026.
</ref>
</ref>
<ref name="wilson-gralspectrum">
<ref name="wilson-gralspectrum">
Line 207: Line 232:
</ref>
</ref>
</references>
</references>
== External links ==
* [https://narenratan.com/tools/gralculator gralculator] - online Gral method calculator


[[Category:Erv Wilson]]
[[Category:Erv Wilson]]
[[Category:MOS scale]]