Skip to content

The AEU chain and T1

The computations for section 4.1 of the brief. Contains 6 code cells and 2 figures.

math/notebooks/02-aeu-ve-t1.ipynb

The code does not run here. The outputs you see were saved when the notebooks were last run.
Code, comments and printed output are in Turkish. The explanations are translated.

Brief 4.1: the number of triangles contained in a chain of n consecutive fifths. V1 (AEU = a chain of 24 fifths) is still an assumption.

This notebook produces computations and figures. The proofs and the report text belong to the students.

Setup

Loads the package and the plotting library. kaydet saves a figure as PNG and SVG into rapor/sekiller. tablo_yaz writes a table as CSV into rapor/tablolar and prints it. t53 is the Tonnetz with 53 divisions, used in the rest of the notebook.

Setup code (imports and helper functions)
from pathlib import Pathimport csvimport matplotlib.pyplot as pltfrom tonnetz import *from tonnetz.plot import draw_latticeRAPOR = Path("..") / ".." / "rapor"SEKIL = RAPOR / "sekiller"; SEKIL.mkdir(parents=True, exist_ok=True)TABLO = RAPOR / "tablolar"; TABLO.mkdir(parents=True, exist_ok=True)def kaydet(fig, ad):    for uzanti in ("png", "svg"):        fig.savefig(SEKIL / f"{ad}.{uzanti}", dpi=300, bbox_inches="tight")def tablo_yaz(ad, basliklar, satirlar):    with open(TABLO / f"{ad}.csv", "w", newline="", encoding="utf-8") as f:        w = csv.writer(f); w.writerow(basliklar); w.writerows(satirlar)    genislik = [max(len(str(x)) for x in sutun) for sutun in zip(basliklar, *satirlar)]    for satir in (basliklar, *satirlar):        print("  ".join(str(x).rjust(g) for x, g in zip(satir, genislik)))t53 = Tonnetz.tet(53)

The chain of 24 pitches

chain_chords(t53, 24, k0) takes 24 consecutive pitches of the chain of fifths starting at position k₀ and lists the chords whose notes all lie in this set. The loop tries all 53 starting positions and collects the (major, minor) count pairs in a set. A single pair in the set shows that the count does not depend on k₀.

In 2

sayilar = set()for k0 in range(53):    cs = chain_chords(t53, 24, k0)    sayilar.add((sum(c.kind == "M" for c in cs), sum(c.kind == "m" for c in cs)))print("(majör, minör) =", sayilar)

Output

(majör, minör) = {(15, 15)}

Brute force for every n

chain_count_table counts the triangles one by one for every chain length n from 0 to N. chain_span gives the span a triangle covers in the chain. formula_range finds the range of n where the count agrees with the formula 2·(n − span). The last column of the table shows for each row whether the formula holds.

In 3

tablo = chain_count_table(t53)aralik = formula_range(t53)print("Zincir açıklığı:", chain_span(t53), " Formülün tuttuğu aralık:", aralik)satirlar = [[r["n"], r["major"], r["minor"], r["total"], 2 * (r["n"] - 9), "evet" if r["total"] == 2 * (r["n"] - 9) else "hayır"] for r in tablo]tablo_yaz("t1-zincir", ["n", "majör", "minör", "toplam", "2(n-9)", "formül tutuyor"], satirlar)

Output

Zincir açıklığı: 9  Formülün tuttuğu aralık: (9, 45)
 n  majör  minör  toplam  2(n-9)  formül tutuyor
 0      0      0       0     -18           hayır
 1      0      0       0     -16           hayır
 2      0      0       0     -14           hayır
 3      0      0       0     -12           hayır
 4      0      0       0     -10           hayır
 5      0      0       0      -8           hayır
 6      0      0       0      -6           hayır
 7      0      0       0      -4           hayır
 8      0      0       0      -2           hayır
 9      0      0       0       0            evet
10      1      1       2       2            evet
11      2      2       4       4            evet
12      3      3       6       6            evet
13      4      4       8       8            evet
14      5      5      10      10            evet
15      6      6      12      12            evet
16      7      7      14      14            evet
17      8      8      16      16            evet
18      9      9      18      18            evet
19     10     10      20      20            evet
20     11     11      22      22            evet
21     12     12      24      24            evet
22     13     13      26      26            evet
23     14     14      28      28            evet
24     15     15      30      30            evet
25     16     16      32      32            evet
26     17     17      34      34            evet
27     18     18      36      36            evet
28     19     19      38      38            evet
29     20     20      40      40            evet
30     21     21      42      42            evet
31     22     22      44      44            evet
32     23     23      46      46            evet
33     24     24      48      48            evet
34     25     25      50      50            evet
35     26     26      52      52            evet
36     27     27      54      54            evet
37     28     28      56      56            evet
38     29     29      58      58            evet
39     30     30      60      60            evet
40     31     31      62      62            evet
41     32     32      64      64            evet
42     33     33      66      66            evet
43     34     34      68      68            evet
44     35     35      70      70            evet
45     36     36      72      72            evet
46     38     38      76      74           hayır
47     40     40      80      76           hayır
48     42     42      84      78           hayır
49     44     44      88      80           hayır
50     46     46      92      82           hayır
51     48     48      96      84           hayır
52     50     50     100      86           hayır
53     53     53     106      88           hayır

The count and the formula are shown in one plot. The dots are the brute-force count. The line is the value of the formula over the range where it holds. The dotted vertical line marks n = 24.

In 4

fig, ax = plt.subplots(figsize=(8, 4.5))ns = [r["n"] for r in tablo]ax.plot(ns, [r["total"] for r in tablo], "o", ms=4, color="#1f3a93", label="sayım (kaba kuvvet)")ax.plot(range(aralik[0], aralik[1] + 1), [2 * (n - 9) for n in range(aralik[0], aralik[1] + 1)], "-", color="#c0392b", label="2·(n − 9)")ax.axvline(24, color="#888888", ls=":"); ax.set_xlabel("zincir uzunluğu n"); ax.set_ylabel("üçgen sayısı"); ax.legend()kaydet(fig, "t1-sayim")
Plot of the number of triangles against chain length n. The count dots lie on the formula line over the range where the formula holds and rise above it after that range.

The shape of the region

For k₀ = 0 the 24 pitches and the chords they contain are drawn on the lattice. node_components and chord_components count how many pieces the region has. Both being 1 shows that the region is one piece. The tests run the same check for every k₀.

In 5

perdeler = chain(t53, 24, 0)akorlar = chain_chords(t53, 24, 0)print("düğüm bileşeni:", len(t53.node_components(perdeler)), " akor bileşeni:", len(t53.chord_components(akorlar)))fig, ax = plt.subplots(figsize=(10, 6.5))draw_lattice(t53, ax, cols=12, rows=8, chords=akorlar, nodes=set(perdeler))kaydet(fig, "aeu-bolge")

Output

düğüm bileşeni: 1  akor bileşeni: 1
The chain of 24 pitches on the lattice with 53 divisions. The pitches of the chain are dark nodes, the major chords it contains are filled triangles and the minor chords are hatched triangles.

Other divisions

The same computation is repeated for every N in the table. The span and the range where the formula holds change with N.

In 6

tablo_yaz("t1-araliklar", ["N", "açıklık", "alt sınır", "üst sınır"],          [[N, chain_span(Tonnetz.tet(N)), *formula_range(Tonnetz.tet(N))] for N in TETS])

Output

 N  açıklık  alt sınır  üst sınır
12        4          4          9
19        4          4         16
31        4          4         28
41        9          9         33
53        9          9         45

Every number on this site comes from data produced by the Python core and is checked by tests.

TÜBİTAK 2204-A mathematics project