Contribution
Joined 18 April 2020
No edit summary |
Contribution (talk | contribs) No edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 180: | Line 180: | ||
May we know how you arrive at these values? I feel that without any context or explanation people are going to have a hard time understanding why you are editing these pages. Thank you! [[User:2^67-1|2^67-1]] 05:50, 28 August 2024 (UTC) | May we know how you arrive at these values? I feel that without any context or explanation people are going to have a hard time understanding why you are editing these pages. Thank you! [[User:2^67-1|2^67-1]] 05:50, 28 August 2024 (UTC) | ||
: Hi. For each pair of superparticular ratios <math>{s1}/{s2}</math> and <math>{s2}/{s3}</math>, there exists a ratio <math>{a}/{b}</math> such that <math>{s1}/{s2}</math> and <math>{s2}/{s3}</math> are <math>{a}/{b}</math> complementary; it is observed that <math>a−b=1</math> or <math>a−b=2</math>. | |||
: In other words, for each ratio <math>a/b</math> where <math>a−b=1</math> or <math>a−b=2</math>, there exists a pair of superparticular ratios <math>{s1}/{s2}</math> and <math>{s2}/{s3}</math> that are <math>{a}/{b}</math> complementary. | |||
: Bellow is a Python code that show for equal divisions of <math>a/b</math> the cent error in the mapping of superparticular ratios <math>{s1}/{s2}</math> and <math>{s2}/{s3}</math> that are <math>a/b</math> complementary. | |||
: When running the tests sequentially for equal divisions of 2/1, 5/3, 3/2, 7/5, 4/3, 9/7, 5/4, 11/9, 6/5, and so on, we observe a converging sequence and pattern for low errors: 5, 7, 12; then 7, 9, 16; then 9, 11, 20; then 11, 13, 24; then 13, 15, 28; then 15, 17, 32; then 17, 19, 36; then 19, 21, 40; then 21, 23, 44; etc. --[[User:Contribution|Contribution]] ([[User talk:Contribution|talk]]) 11:08, 28 August 2024 (UTC) | |||
<pre> | |||
# Enter the values for the X ratio of EDX. Ensure the numerator and denominator differ by 1 or 2. | |||
numerator, denominator = 3, 2 | |||
# Program | |||
from math import log | |||
def calculate_complementary_pair(numerator, denominator): | |||
""" | |||
Calculates the superparticular complementary pair based on the difference | |||
between the numerator and denominator. | |||
""" | |||
diff = numerator - denominator | |||
if diff == 1: | |||
# Case where numerator and denominator differ by 1 | |||
numerator_2 = numerator * 2 | |||
denominator_2 = numerator + denominator | |||
numerator_3 = numerator + denominator | |||
denominator_3 = denominator * 2 | |||
elif diff == 2: | |||
# Case where numerator and denominator differ by 2 | |||
numerator_2 = numerator | |||
denominator_2 = int((numerator + denominator) / 2) | |||
numerator_3 = int((numerator + denominator) / 2) | |||
denominator_3 = denominator | |||
else: | |||
raise ValueError("Invalid input: numerator and denominator must differ by 1 or 2.") | |||
return (numerator_2, denominator_2), (numerator_3, denominator_3) | |||
def calculate_log_ratio(ratio): | |||
""" | |||
Calculates the logarithmic value of a ratio in cents. | |||
""" | |||
return 1200 * log(ratio) / log(2) | |||
def print_mappings(ratio_log, superparticular_log, numerator, denominator): | |||
""" | |||
Prints the mapping of ratios and their differences in logarithmic cents. | |||
""" | |||
for ed in range(1, 101): | |||
mapping = int(superparticular_log / (ratio_log / ed) + 0.5) # Rounds to the nearest integer | |||
error = mapping * (ratio_log / ed) - superparticular_log | |||
print(f"scale: {ed}ed{numerator}/{denominator}, error: {error:.5f}") | |||
# Calculate the superparticular complementary pairs | |||
(pair_1, pair_2) = calculate_complementary_pair(numerator, denominator) | |||
print(f"Successive superparticular complementary pair of {numerator}/{denominator}: {pair_1[0]}/{pair_1[1]} and {pair_2[0]}/{pair_2[1]}") | |||
# Calculate ratios | |||
ratio = numerator / denominator | |||
superparticular_complementary_ratio = pair_1[0] / pair_1[1] | |||
# Calculate the logarithmic values for the ratios in cents | |||
ratio_log_cents = calculate_log_ratio(ratio) | |||
superparticular_complementary_log_cents = calculate_log_ratio(superparticular_complementary_ratio) | |||
# Output the mappings | |||
print_mappings(ratio_log_cents, superparticular_complementary_log_cents, numerator, denominator) | |||
</pre> |