User:2^67-1/Sandbox: Difference between revisions

2^67-1 (talk | contribs)
m Added table
2^67-1 (talk | contribs)
mNo edit summary
 
(43 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Testing=
A program to find increasingly better EDns in a given subgroup with a given equave ('increasingly better' is given by decreasing relative error)


The '''blackwood-dicot-semaphore''' equivalence continuum is a continuum of 7-limit rank-3 temperaments describing the set of all 7-limit rank-3 temperaments supported by [[10edo]]. Any rank-2 temperament supported by [[10edo]] can thus be represented by a line between two points in this continuum.
<syntaxhighlight lang="python">
import math


All temperaments in the continuum satisfy (25/24)<sup>''p''</sup>(49/48)<sup>''q''</sup> ~ 256/243, equating a stack of [[25/24|dicot commas (25/24)]] and [[49/48|semaphore commas (49/48)]] with the [[256/243|blackwood comma (256/243)]].
def fracmult(a,b):
    g = math.gcd(a[0]*b[0],a[1]*b[1])
    return [a[0]*b[0]//g,a[1]*b[1]//g]


The blackwood comma is the characteristic [[3-limit]] comma tempered out in 10edo.
def reciprocal(a):
    return [a[1],a[0]]


{| class="wikitable center-1 center-2"
def equavereduce(a,b):
|+ Temperaments with integer ''p'' and ''q''
    while b[0]*a[1] > a[0]*b[1]:
|-
        b = fracmult(b,reciprocal(a))
! rowspan="2" | ''p''
    while b[0] < b[1]:
! rowspan="2" | ''q''
        b = fracmult(b,a)
! rowspan="2" | Temperament
    return b
! colspan="2" | Comma
 
|-
def tonalitydiamond(a,b,c):
! Ratio
    return [equavereduce(a,b),equavereduce(a,reciprocal(b)),equavereduce(a,c),equavereduce(a,reciprocal(c)),equavereduce(a,fracmult(b,reciprocal(c))),equavereduce(a,fracmult(c,reciprocal(b)))]
! Monzo
 
|-
def cents(a):
| 0 || 0 || [[Blackwood]] || [[256/243]] || {{monzo| 8 -5 0 0 }}
    return 1200*math.log2(a[0]/a[1])
|-
 
| 0 || 1 || ?????? || [[4096/3969]] || {{monzo| 12 -4 0 -2 }}
def centslist(a):
|-
    c = []
| 0 || 2 || ?????? || [[65536/64827]] || {{monzo| 16 -3 0 -4 }}
    for i in a:
|-
        c.append(cents(i))
| 0 || 3 || ?????? || [[1058841/1048576]] || {{monzo| -20 2 0 6 }}
    return c
|-
 
| 0 || ∞ || [[Semaphore]] || [[49/48]] || {{monzo| -4 -1 0 2 }}
def ednerror(a,e,equave):
|-
    step = cents(equave)/e
| 1 || 0 || [[Srutal]] || [[2048/2025]] || {{monzo| 11 -4 -2 0 }}
    approx = round(a/step,0)*step
|-
    error = math.fabs(a-approx)
| 1 || 1 || [[Mirwomo temperaments|Mirwomo]] || [[33075/32768]] || {{monzo| 15 -3 -2 -2 }}
    return error
|-
 
| 1 || ∞ || [[Jubilic]] || [[50/49]] || {{monzo| 1 0 2 -2 }}
def ednerrorlist(a,e,equave):
|-
    error = []
| 2 || 0 || [[Negri]] || [[16875/16384]] || {{monzo| -14 3 4 0 }}
    for i in a:
|-
        error.append(ednerror(cents(i),e,equave))
| ∞ || 0 || [[Dicot]] || [[25/24]] || {{monzo| -3 -1 2 0 }}
    return error
|-
 
| ∞ || 1 || [[Jubilic]] || [[50/49]] || {{monzo| 1 0 2 -2 }}
def euc(a):
|-
    total = 0
| ∞ || 2 || [[Breedsmic]] || [[2401/2400]] || {{monzo| -5 -1 -2 4 }}
    for i in a:
|}
        total = total + i**2
    return total**(1/2)
 
def avg(a):
    total = 0
    for i in a:
        total = total + i
    return total/len(a)
   
 
best = 10**10
 
for i in range(1, 100000):
    if avg(ednerrorlist(tonalitydiamond([3,2],[5,2],[7,4]),i,[3,2]))*i < best:
        best = avg(ednerrorlist(tonalitydiamond([3,2],[5,2],[7,4]),i,[3,2]))*i
        print(i)
</syntaxhighlight>