Pythagoras ratios#

from fractions import Fraction

from stringcalc.frets import distances

Define the ratios#

I first saw these in this StackExchange post. The same diagram can be found here, which seems to be the original source. I used this table to fill in (most of) the gaps (leaving out fret 6 since it is ambiguous).

# This maps the fret number to the relative distance to the saddle.
ratios = {
  1: "243/256",
  2: "8/9",
  3: "27/32",
  4: "64/81",
  5: "3/4",
  7: "2/3",
  8: "81/128",
  9: "16/27",
  10: "9/16",
  11: "128/243",
  12: "1/2",
}
ratios = {k: Fraction(v) for k, v in ratios.items()}

Compare to our equal-temperament calculations#

We use stringcalc.frets.distances().

df = distances(12, L=1)
df["Pythagoras"] = df.index.map(ratios)
df["Pythagoras float"] = df["Pythagoras"].astype(float)

(
    df
    .assign(**{
        "Δ": df["Pythagoras float"] - df["d_inv"],
        "Equal temperament": df["d_inv"]}
    )
    [["Pythagoras", "Pythagoras float", "Equal temperament", "Δ"]]
    .fillna("")
)
Pythagoras Pythagoras float Equal temperament Δ
n
1 243/256 0.949219 0.943874 0.005344
2 8/9 0.888889 0.890899 -0.00201
3 27/32 0.84375 0.840896 0.002854
4 64/81 0.790123 0.793701 -0.003577
5 3/4 0.75 0.749154 0.000846
6 0.707107
7 2/3 0.666667 0.667420 -0.000753
8 81/128 0.632812 0.629961 0.002852
9 16/27 0.592593 0.594604 -0.002011
10 9/16 0.5625 0.561231 0.001269
11 128/243 0.526749 0.529732 -0.002983
12 1/2 0.5 0.500000 0.0