User:Fastaro/Generalized Pythagorean tuning: Difference between revisions

Fastaro (talk | contribs)
Fastaro (talk | contribs)
Line 66: Line 66:


# Define the range/edo for 'x'
# Define the range/edo for 'x'
limit = 12
limit = 7


# Print out the values of 'n' and the ratio for each 'x'
# Initialize lists to store the results
ratios1 = []
ratios2 = []
 
# Calculate and store the values of 'n' and the ratios for each 'x'
for x in range(limit):
for x in range(limit):
     n = calculate_n(x, p, q)
     n = calculate_n(x, p, q)
     ratio1 = (p**x) / (q**n)
     ratio1 = (p**x) / (q**n)
     print(f'For x={x}, n={n}, the ratio p^x/q^n is: {ratio1}')
     ratios1.append(ratio1)
    ratio2 = (q**(n+1)) / (p**x)
    if (x != limit-1):
    print(f'For x={x}, n={n}, the ratio q^n+1/p^x is: {ratio2}')
        ratio2 = (q**(n+1)) / (p**x)
        ratios2.append(ratio2)
 
combined_ratios = ratios1 + ratios2
 
# Sort the combined list from lowest to highest
sorted_combined_ratios = sorted(combined_ratios)
formatted_ratios = '\n'.join([f'{ratio:.16f}'.replace('.', ',').rstrip('0').rstrip(',') for ratio in sorted_combined_ratios[1:]])
 
print(formatted_ratios)
 
</syntaxhighlight>
</syntaxhighlight>
# For x=0, n=0, the ratio p^x/q^n is: 1.0000000000000000
# For x=0, n=0, the ratio q^(n+1)/p^x is: 2.0000000000000000
# For x=1, n=1, the ratio p^x/q^n is: 1.5000000000000000
# For x=1, n=1, the ratio q^(n+1)/p^x is: 1.3333333333333333
# For x=2, n=3, the ratio p^x/q^n is: 1.1250000000000000
# For x=2, n=3, the ratio q^(n+1)/p^x is: 1.7777777777777777
# For x=3, n=4, the ratio p^x/q^n is: 1.6875000000000000
# For x=3, n=4, the ratio q^(n+1)/p^x is: 1.1851851851851851
# For x=4, n=6, the ratio p^x/q^n is: 1.2656250000000000
# For x=4, n=6, the ratio q^(n+1)/p^x is: 1.5802469135802468
# For x=5, n=7, the ratio p^x/q^n is: 1.8984375000000000
# For x=5, n=7, the ratio q^(n+1)/p^x is: 1.0534979423868314
# For x=6, n=9, the ratio p^x/q^n is: 1.4238281250000000
# For x=6, n=9, the ratio q^(n+1)/p^x is: 1.4046639231824416
# For x=7, n=11, the ratio p^x/q^n is: 1.0678710937500000
# For x=7, n=11, the ratio q^(n+1)/p^x is: 1.8728852309099222
# For x=8, n=12, the ratio p^x/q^n is: 1.6018066406250000
# For x=8, n=12, the ratio q^(n+1)/p^x is: 1.2485901539399482
# For x=9, n=14, the ratio p^x/q^n is: 1.2013549804687500
# For x=9, n=14, the ratio q^(n+1)/p^x is: 1.6647868719199308
# For x=10, n=15, the ratio p^x/q^n is: 1.8020324707031250
# For x=10, n=15, the ratio q^(n+1)/p^x is: 1.1098579146132872
# For x=11, n=17, the ratio p^x/q^n is: 1.3515243530273438
# For x=11, n=17, the ratio q^(n+1)/p^x is: 1.4798105528177163


== Implications and applications ==
== Implications and applications ==