developing a notational comma popularity metric

User avatar
Dave Keenan
Site Admin
Posts: 1305
Joined: Tue Sep 01, 2015 2:59 pm
Location: Brisbane, Queensland, Australia
Contact:

Re: developing a notational comma popularity metric

Post by Dave Keenan »

cmloegcmluin wrote: Mon Aug 17, 2020 8:36 am For purposes of both my writeup and my code, do you consider N2D3P9 to be:
  1. a function which takes any ratio as an argument,
    then 5-roughens it, then takes its reciprocal if necessary so that n ≥ d, then applies the formula
  2. a function which expects a 5-rough ratio with n ≥ d,
    and if given something other than that, either errors or gives bogus results
  3. something else
My feeling is that the answer is probably (a).
I was surprised at how difficult I found it, to answer this.

I think there may well be different answers for code versus writeup (pedagogy). Code should certainly never give bogus results. And for both purposes I think we should include within N2D3P9 the flipping of the ratio or monzo terms so n ≥ d.

I think that while returning an error or 5-roughing are both valid choices in software, depending on performance versus convenience, I think that pedagogically it is important to get across the message that N2D3P9 is only intended to compare 5-rough ratios, which are the things (or equivalence-classes of things) that need symbols to notate them as alterations from a Pythagorean backbone of nominals plus sharps and flats. So, if N2D3P9 is applied to non-5-rough ratios (either commas or pitch ratios) then the 5-roughing step should always be shown explicitly, e.g. as N2D3P9(5Rough(64/63)).

1/1 is the only 5-rough ratio for which n may be equal to d. But we still have to allow for it by saying n ≥ d and not n > d.

There's another point re 1/1. There's a sense in which, because we're dealing with 5-rough ratios, the prime limit of 1/1 for the purpose of calculating N2D3P9, is 3, not 1. That moves its N2D3P9 value from 0.11 to 0.33 — closer to its "true rank" (as derived from N2D3P9), namely 1.

User avatar
cmloegcmluin
Site Admin
Posts: 999
Joined: Tue Feb 11, 2020 3:10 pm
Location: San Francisco, California, USA
Real Name: Douglas Blumeyer
Contact:

Re: developing a notational comma popularity metric

Post by cmloegcmluin »

Alright, here's my first crack at something like a Xen Wiki post. Of course some bits are lifted directly from your writings on this topic:

N2D3P9 is a function which, given a pitch ratio, estimates its rank in popularity among all pitch ratios in musical practice. A low N2D3P9 indicates that the ratio is used often, while a high N2D3P9 indicates that the ratio is used rarely.

N2D3P9 was developed to help decide which ratios are the most important for a JI microtonal notation system to notate in the simplest way. Because factors of 2 and 3 in pitch ratios can already be notated by changes in the nominal (C, D, E, F, G, A, B) or the count of sharps and flats, N2D3P9 ignores factors of 2 or 3 in the ratio.

As an example, N2D3P9(5/4) ≈ 1, representing the fact that 5/4 is the simplest possible ratio with a factor other than 2 or 3, and therefore the most popularly used in musical practice. N2D3P9(8/5) shares the same value as N2D3P9(5/4), because 5/4 and 8/5 are essentially equivalent. As another example, N2D3P9(80/77) ≈ 39, suggesting that approximately 38 other undirected 5-rough ratios exist which are more popularly used than 77/5.

Formula

The formula for N2D3P9(`r`) is:

$$ \frac{nd⋅\text{gpf}(nd)}{2^{Ω(n)}3^{Ω(d) + 2}} $$
where Note that `nd` is established in music theory as a ratio's Benedetti height, or product complexity.

N2D3P9 can be rewritten as

$$\frac{n}{2^{Ω(n)}}×\frac{d}{3^{Ω(d)}}×\frac{\text{gpf}(nd)}{9} $$
Then note that where

`n = 5^{n_5}×7^{n_7}×...`

we have

`2^{\Ω(n)}=2^{n_5}×2^{n_7}×...`.

and so

`\frac{n}{2^{Ω(n)}}`

can be written as

`(\frac{5}{2})^{n_5}×(\frac{7}{2})^{n_7}×...`

and

`\frac{d}{3^{Ω(d)}}`

can be written as

`(\frac{5}{3})^{d_5}×(\frac{7}{3})^{d_7}×...`

These can be described as "product of half prime factors of the numerator (with repeats)" and "product of one-third prime factors of the denominator (with repeats)". It may be simpler to describe it verbally as:

Take the prime factorization of the numerator and divide all the primes by 2, then multiply it out again. Do the same with the denominator but divide by 3 instead of 2. Multiply these two results together then multiply by the prime limit of the ratio and divide by 9.

Development

N2D3P9 was developed from May to August 2020 as a collaborative effort among members of the Sagittal forum, led by Sagittal co-creator Dave Keenan and Douglas Blumeyer. Many functions besides N2D3P9 were considered before selecting it as the best function for its purpose.

Estimation of pitch ratio popularity is possible because it correlates with numeric simplicity. N2D3P9 is most useful when comparing ranks of more complex ratios, because usage data about such ratios is sparse. By fitting a function to the statistical usage data which is available for simpler ratios, N2D3P9 enables the extension of the patterns found in these simpler ratios.

Actual pitch ratio usage statistics were taken from the Huygens-Fokker Foundation's scale archives for their popular microtonal software Scala. Each occurrence of a pitch ratio in a scale was counted as one vote for that ratio. Data on the relative popularities of the scales in the archive was not available.

Rather than attempt to fit functions to the exact counts of votes for each ratio, the functions were fit to the rank indices of each ratio; in other words, a function only needed to sort ratios the same as the actual data, and within each rank position it was unimportant how close its estimate of votes was. In technical parlance, the goal was to minimize the Spearman’s rank coefficient between the estimated ranks and the actual ranks. For purposes of comparing competing functions, minimizing Spearman’s rank coefficient could be simplified to minimizing the sum of squared differences between the ranks. And because fitting to the simpler ratios which had more votes is more important, the squared differences were weighted; the vote counts were observed to conform to the Zipf’s law, so this was selected as the weighting mechanism. A fractional ranking strategy was used to ensure that stretches of the data with tied vote counts did not distort the measurement.

The overall strategy, then, was to minimize this weighted rank correlation, while also minimizing the complexity of the function, to avoid overfitting. The 5-rough-ratio notational popularity ranking function that had been used by the creators of Sagittal was `\text{sopfr}` (sum of prime factors with repetition), and as simple as this function is, it does a remarkably good job of estimating the rank of pitch ratios. For comparison, the weighted sum of squares `\text{sopfr}` gives for the Scala stats is about 0.026, while the weighted sum of squares N2D3P9 gives is about 0.010. Functions giving sums of squares as low as 0.008 were found, however, these functions were so complex that they probably were fitting to noise in the Scala stats instead of to the true nature of musical pitch. An informal “chunk” metric was devised to compare function complexity in terms of fit to the data, with considered functions ranging from one chunk (`\text{sopfr}`) to eight chunks; the winning function N2D3P9 has five chunks.

Several techniques were used to find and decide on N2D3P9 as the best 5-rough ratio notational popularity rank estimation function. Initial observations about shortcomings of `\text{sopfr}`, such as its failure to differentiate balanced ratios from their imbalanced equivalents — such as 11/5 versus 55/1 — or those with different prime limits such as 13/5 and 11/7, despite those pairs of ratios exhibiting remarkably different actual ranks in the Scala stats, formed the basis of the investigation. Psychoacoustic plausibility of functions was used as a top-down guide for experimentation. Optimization tools such as Excel's Evolutionary Solver were used to navigate toward ideal values for each parameter. A brute-force technique was also utilized whereby nearly 2 billion functions combined out of constituent "submetrics" were checked automatically. In the end, one of the functions generated from the brute-force checker was recognized as being re-writable in a much simpler form with parameter values rounded to whole numbers without doing much damage to its sum-of-squares, and thus N2D3P9 was born.

User avatar
cmloegcmluin
Site Admin
Posts: 999
Joined: Tue Feb 11, 2020 3:10 pm
Location: San Francisco, California, USA
Real Name: Douglas Blumeyer
Contact:

Re: developing a notational comma popularity metric

Post by cmloegcmluin »

Dave Keenan wrote: Mon Aug 17, 2020 10:40 am I was surprised at how difficult I found it, to answer this.
I know, right?!
I think there may well be different answers for code versus writeup (pedagogy). Code should certainly never give bogus results. And for both purposes I think we should include within N2D3P9 the flipping of the ratio or monzo terms so n ≥ d.

I think that while returning an error or 5-roughing are both valid choices in software, depending on performance versus convenience, I think that pedagogically it is important to get across the message that N2D3P9 is only intended to compare 5-rough ratios, which are the things (or equivalence-classes of things) that need symbols to notate them as alterations from a Pythagorean backbone of nominals plus sharps and flats. So, if N2D3P9 is applied to non-5-rough ratios (either commas or pitch ratios) then the 5-roughing step should always be shown explicitly, e.g. as N2D3P9(5Rough(64/63)).
Okay. I agree with your pedagogical reasoning here. I'll revise my write-up to account for that. Thanks for thinking it through.

And I'll tweak my code so that 5-roughening occurs separately before calling N2D3P9. But I won't let N2D3P9 return bogus results. If it receives a non-5-roughened ratio, it will error.
1/1 is the only 5-rough ratio for which n may be equal to d. But we still have to allow for it by saying n ≥ d and not n > d.
I hadn't noticed that. Thanks for pointing it out.
There's another point re 1/1. There's a sense in which, because we're dealing with 5-rough ratios, the prime limit of 1/1 for the purpose of calculating N2D3P9, is 3, not 1. That moves its N2D3P9 value from 0.11 to 0.33 — closer to its "true rank" (as derived from N2D3P9), namely 1.
It had bothered me a tad that 1/1 has rank of 1/9...

but isn't 5/1 rank 1, and 1/1 (along with all 3-limit ratios) more like rank 0?

You asked me to round N2D3P9 values to two digits, but I expect most of time we can get away with zero digits, which would kind of solve this problem.

1/1 having a prime limit of 3 in this context is a wild and fun thought, though, and I don't disagree with it conceptually.

User avatar
cmloegcmluin
Site Admin
Posts: 999
Joined: Tue Feb 11, 2020 3:10 pm
Location: San Francisco, California, USA
Real Name: Douglas Blumeyer
Contact:

Re: developing a notational comma popularity metric

Post by cmloegcmluin »

Dave Keenan wrote: Mon Aug 17, 2020 10:09 am
cmloegcmluin wrote: Mon Aug 17, 2020 3:13 am Might be interesting to see the introducing levels of each of symbols too, no, both here and in the list < 136, or whatever cut-off we choose? Let me know if you're interested in that and I can get them in there.
That would be good. Either a number for the level (0 = Spartan), or "low", "medium", "high", "ultra", ...
Ok, I'll get to that after dinner.
if you're going to use undirected, I thought we agreed the canonical form for those has the small number first, to be consistent with extended ratios for chords, e.g. 4:5:6.
You figured out what I meant re: 5/1 being :/|: for these purposes. Alright, I'll put them back to undirected ratios, then, with colons when I add the introducing levels.

I could have at least gotten the 1:5 orientation correct, though. Sorry about that.
If one goal is to enable as many ratios as possible to be exactly notatable, it seems reasonable. But I'm thinking this could turn into quite the rabbit hole of a thing to optimize for.
Yes. Let's set the whole revisit of the Extreme JI notation to one side until we've assigned the tina ratios and updated SMuFL and Bravura. I'm pretty sure there are no unaccented symbols or unsymbolled accents in danger of being redefined, and hence no effect on the definitions already in SMuFL (except the errors you found some months back).
I got a little confused there for a few minutes, until I recognized that "unsymbolled" is different from "unsymbolized" and was meant to parallel "unaccented". Yes. The Steinberg mission is blocked on the tina assignment. But it is not blocked on any changes we might find we want to make to accented symbols (or symbolled accents!). And the Steinberg mission is higher priority.
I'd be happy if we just found alternatives with N2D3P9 ≤ 216 for the two worst offenders.
Here's our options for replacing the 19:4375s :,::)|:

comma   prime  5-rough  cents   monzo                            ratio         apotome  N2D3P9
name    limit  sopfr                                                           slope
11/65s  13     29       2.9716  [ 20 -11 -1 0 1 -1 ⟩       11534336/11514555   -11.2     86.06
7/85s   17     29       2.9718  [ -17 13 -1 1 0 0 -1 ⟩     11160261/11141120    12.8     93.66
253s    23     34       3.0523  [ -27 12 0 0 1 0 0 0 1 ⟩  134454573/134217728   11.8    161.64
1/575s  23     33       3.0082  [ 6 2 -2 0 0 0 0 0 -1 ⟩         576/575          1.8    183.68

We have 65/11 already notatable with :,::,::|): but 85/7 is not yet exactly notatable. Not sure about the other two.

And here's our options for replacing the 14641k :,::)|(:

comma   prime  5-rough  cents   monzo                            ratio         apotome  N2D3P9
name    limit  sopfr                                                           slope
5/121k  11     27       9.0928  [ -16 13 1 0 -2 ⟩           7971615/7929856     12.4     61.62
143/5k  13     29       9.4419  [ -8 2 -1 0 1 1 ⟩              1287/1280         1.4     86.06
95/7k   19     31       9.1358  [ 1 -3 1 -1 0 0 0 1 ⟩           190/189         -3.6    116.99

None of 121/5, 143/5, or 95/7 are exactly notatable yet.

Apologies for the table formatting. I've taken a note to add an option to the table formatting method in the code base to allow it to generate the nicer table/td/th/tr bbCode.
I have some ideas on how to reliably get the max prime exponents for the denominators, for a given max N2D3P9. I'll write it up when I get the chance. But the important thing now is the writeup of N2D3P9. Let's consider the above list-generating symbol-matching exercise as having been a shakedown-cruise to make sure N2D3P9 was fit for purpose. IMHO it passed with flying colours.
Cool cool cool. Yes, agreed.
sagittate (verb): To cogitate on anything related to Sagittal notation.
: D I suppose I should rename my study to my "sagittation chamber".
Dave Keenan wrote: Mon Aug 17, 2020 10:12 am
cmloegcmluin wrote: Mon Aug 17, 2020 8:17 am Can't believe it's only occurring to me to ask this now, but what did y'all do with the pitches in the Scala archive given in cents? I find a couple 386.3137s in there, but I assume those didn't get counted as votes for 5/1. Because what would you have done with 386.31499, 386.31055, 386.31312, 386.31742, etc... those are probably votes for 5/1, but where do you draw the line? Partial votes, according to some harmonic entropy like mapping? Or was the idea that since the project was assigning primary commas to symbols for a JI notation that it was just fine if not the right thing to do to count only votes given by people explicitly working in JI?
Good thought. It hadn't occurred to me either. We ignored them. But now that you've raised the idea, I say "too hard" (for exactly the reasons you point out) and unlikely to shed any new light on anything.
Word.
Last edited by Dave Keenan on Mon Aug 17, 2020 5:46 pm, edited 1 time in total.
Reason: Squeezed the columns in the two tables above.

User avatar
Dave Keenan
Site Admin
Posts: 1305
Joined: Tue Sep 01, 2015 2:59 pm
Location: Brisbane, Queensland, Australia
Contact:

Re: developing a notational comma popularity metric

Post by Dave Keenan »

Thanks for the writeup. Will comment soon.
cmloegcmluin wrote: Mon Aug 17, 2020 3:13 am Consider the ratio with the dubious distinction of being the ratio out of those that Sagittal doesn't notate exactly which has the lowest N2D3P9: 25/11. If there was a symbol in the Sagittal JI notation with a primary comma that exactly notated this ratio, that comma would be 100/99 which is about 17.4 cents. So it'd be competing with 99/98, the 11/49C, which has both higher SoPF>3 (25 vs 22) and higher N2D3P9 (54.90 vs 28.01). No other symbol covers 49/11 though, so we'd be sacrificing coverage of it for 25/11. But theoretically it'd still be a trade we'd want to make (well, except the 11/49C has apotome slope of 0.91, while the 25/11C has -3.07).
I just had the thought that the difference between 11:25C and 11:49C would be a good candidate for the definition of some whole number of tinas, so the corresponding accent could be used to give exact symbols for these two commas.

Turns out (99×99)/(100×98) or 1225/121n is about 1.257 tinas and is the ratio that George proposed for 1 tina.
viewtopic.php?p=1613#p1613

Sorry. I should have kept such sagittations to myself, since they don't relate to the N2D3P9 writeup.

User avatar
Dave Keenan
Site Admin
Posts: 1305
Joined: Tue Sep 01, 2015 2:59 pm
Location: Brisbane, Queensland, Australia
Contact:

Re: developing a notational comma popularity metric

Post by Dave Keenan »

cmloegcmluin wrote: Mon Aug 17, 2020 12:17 pm but isn't 5/1 rank 1, and 1/1 (along with all 3-limit ratios) more like rank 0?
There aint no such thing as rank 0. https://en.wikipedia.org/wiki/Ranking

But I'd still be willing to use it, if it made sense in some way. Kinda like the zeroth law of thermodynamics or Asimov's zeroth law of robotics. But if you plot N2D3P9 against the true rank induced by that function, over all ratios up to 136, then a best-fit line not constrained to pass thru (0, 0) passes closer to (1, 1) than (1, 0), where the coordinates for N2D3P9(1/1) are (1, 0.33). So it works best to keep the standard definition of rank, rather than subtracting 1 from it. Or putting it another way, it works best to keep 1/1 in the set that is ranked.

On the graph below, your proposal that the rank of 1/1 should be zero, corresponds to shifting all the points, and the trendline, 1 position to the left.

Image

BTW, that slope of 1.03 for the best fit line above, goes up to 1.04 when I force a (0, 0) intercept, which tells us that we can expect to get about 4% fewer ratios than the maximum N2D3P9 that we set. Hence 131 ratios under 136.
You asked me to round N2D3P9 values to two digits, but I expect most of time we can get away with zero digits, which would kind of solve this problem.
I assume you mean "decimal places" above, when you write "digits". I'm pretty sure there are some values in the list up to 136 that were distinct, but would not remain distinct, unless you keep 2 decimal places.

[Edit: Changed "a best-fit line of slope = 1" to "a best-fit line not constrained to pass thru (0, 0)".]
Attachments
N2D3P9BestFit.png
(6.35 KiB) Not downloaded yet

User avatar
cmloegcmluin
Site Admin
Posts: 999
Joined: Tue Feb 11, 2020 3:10 pm
Location: San Francisco, California, USA
Real Name: Douglas Blumeyer
Contact:

Re: developing a notational comma popularity metric

Post by cmloegcmluin »

Dave Keenan wrote: Mon Aug 17, 2020 1:16 pm Thanks for the writeup. Will comment soon.
cmloegcmluin wrote: Mon Aug 17, 2020 3:13 am Consider the ratio with the dubious distinction of being the ratio out of those that Sagittal doesn't notate exactly which has the lowest N2D3P9: 25/11. If there was a symbol in the Sagittal JI notation with a primary comma that exactly notated this ratio, that comma would be 100/99 which is about 17.4 cents. So it'd be competing with 99/98, the 11/49C, which has both higher SoPF>3 (25 vs 22) and higher N2D3P9 (54.90 vs 28.01). No other symbol covers 49/11 though, so we'd be sacrificing coverage of it for 25/11. But theoretically it'd still be a trade we'd want to make (well, except the 11/49C has apotome slope of 0.91, while the 25/11C has -3.07).
I just had the thought that the difference between 11:25C and 11:49C would be a good candidate for the definition of some whole number of tinas, so the corresponding accent could be used to give exact symbols for these two commas.

Turns out (99×99)/(100×98) or 1225/121n is about 1.257 tinas and is the ratio that George proposed for 1 tina.
viewtopic.php?p=1613#p1613

Sorry. I should have kept such sagittations to myself, since they don't relate to the N2D3P9 writeup.
Haha, that's fine.

Great point. But yes, let's also save such sagittations for our glorious homecoming to the Magrathean topic you linked to. :)

And I, for my part, jumped the gun on sharing those possibilities for replacing 19:4375s and 14641k. I guess I had thought you meant we should knock those two out right away, but I've since noticed you said "we need to wait until we have a comma-no-pop-rank" and you meant we needed to wait to make a call for those two as well. I guess I just got excited to run my comma finder script again for the first time in a couple months, now with more 5-rough-ratio-no-pop-rank! But we still don't know exactly how to reconcile it with apotome slope. fi-ro-ra-no-po-ra-apo-slo? *sheesh*
Dave Keenan wrote: Mon Aug 17, 2020 2:16 pm
cmloegcmluin wrote: Mon Aug 17, 2020 12:17 pm but isn't 5/1 rank 1, and 1/1 (along with all 3-limit ratios) more like rank 0?
There aint no such thing as rank 0. https://en.wikipedia.org/wiki/Ranking
Ugh. A Google search for rank 0 turned up only stuff about a Google search concept with that name. No thanks.

Okay, I admit rank 0 does just feel wrong on a deep level. And I don't think a rank 0 for N2D3P9 can boast of any cool justification like either of the zeroth law examples you give. And your graph proves the point. So yes, let's give 1/1 a special N2D3P9 of 0.33.

By the way, I would plan to include a table of the top 100 ratios by N2D3P9 in a Xen Wiki post.
BTW, that slope of 1.03 for the best fit line above, goes up to 1.04 when I force a (0, 0) intercept, which tells us that we can expect to get about 4% fewer ratios than the maximum N2D3P9 that we set. Hence 131 ratios under 136.
Ah, that's great to know! Thanks for that.
You asked me to round N2D3P9 values to two digits, but I expect most of time we can get away with zero digits, which would kind of solve this problem.
I assume you mean "decimal places" above, when you write "digits". I'm pretty sure there are some values in the list up to 136 that were distinct, but would not remain distinct, unless you keep 2 decimal places.
I did mean digits yes. And you are correct, of course, there are clearly some values that would get conflated if we rounded to whole numbers. Hence my "most of the time". I guess was thinking about when we'd use them to choose among tinas, e.g. we're probably fine when comparing the 25/11C and 11/49C to use 28 and 55 instead of 28.01 and 54.90. I should have been more specific and said something more like "While I know you asked me to round N2D3P9 values to two digits for this context, I expect that in other contexts most of the time we can get away with zero digits". Oy, that would still round 1/1 to rank 0 though. I dunno, maybe two decimal places would be a good convention.

Alright, I look forward to your feedback on the write-up. Call it like you see it. There's nothing in there I'm precious about. Only spent a couple hours on it.

(edit: updated the table of top N2D3P9 ratios with introducing level indices, returned to undirected ratios, but oriented them properly now: viewtopic.php?p=2246#p2246)

User avatar
Dave Keenan
Site Admin
Posts: 1305
Joined: Tue Sep 01, 2015 2:59 pm
Location: Brisbane, Queensland, Australia
Contact:

Re: developing a notational comma popularity metric

Post by Dave Keenan »

cmloegcmluin wrote: Mon Aug 17, 2020 3:27 pm And I, for my part, jumped the gun on sharing those possibilities for replacing 19:4375s and 14641k. I guess I had thought you meant we should knock those two out right away, but I've since noticed you said "we need to wait until we have a comma-no-pop-rank" and you meant we needed to wait to make a call for those two as well. I guess I just got excited to run my comma finder script again for the first time in a couple months,
I was impressed with how quickly you found those other options. But I will resist further comment.
now with more 5-rough-ratio-no-pop-rank! But we still don't know exactly how to reconcile it with apotome slope. fi-ro-ra-no-po-ra-apo-slo? *sheesh*
I note that you can omit the word "ratio" from "5-rough-ratio-no-pop-rank", as suggested here:
viewtopic.php?f=4&t=493&p=2244#nopoprank
Okay, I admit rank 0 does just feel wrong on a deep level. And I don't think a rank 0 for N2D3P9 can boast of any cool justification like either of the zeroth law examples you give. And your graph proves the point. So yes, let's give 1/1 a special N2D3P9 of 0.33.
I'm glad we agree. I've now updated the 0.11 to 0.33 in your earlier list. However I don't really see it as a "special value". I think that 3 simply is the prime limit of a 5-rough monzo with all zeros.
By the way, I would plan to include a table of the top 100 ratios by N2D3P9 in a Xen Wiki post.
The top 100 "5-rough ratios" or "2,3-reduced ratios", as the heading should say. In that context, I think the ratios should be given with slashes, not colons, and with the big number first. That's because we want them to be read as pitch ratios, not interval ratios.
You asked me to round N2D3P9 values to two digits, but I expect most of time we can get away with zero digits, which would kind of solve this problem.
I assume you mean "decimal places" above, when you write "digits". I'm pretty sure there are some values in the list up to 136 that were distinct, but would not remain distinct, unless you keep 2 decimal places.
I did mean digits yes.
Then you are mistaken. :) I never suggested rounding to two "digits" (which could mean 2 "significant digits"). I suggested rounding to 2 "decimal places". :)

But really, I assume you just made the same thinko again. Maybe 'cause it's getting late. :) Either that, or there's some convention here I'm not aware of.
And you are correct, of course, there are clearly some values that would get conflated if we rounded to whole numbers.
And there are some that would still be conflated if we rounded to one decimal place.
Hence my "most of the time". I guess was thinking about when we'd use them to choose among tinas, e.g. we're probably fine when comparing the 25/11C and 11/49C to use 28 and 55 instead of 28.01 and 54.90.
Sure.
I should have been more specific and said something more like "While I know you asked me to round N2D3P9 values to two digits for this context, I expect that in other contexts most of the time we can get away with zero digits".
You mean zero decimal places. :)
Oy, that would still round 1/1 to rank 0 though.
That would be OK. It's the price we pay for blurring the distinction between N2D3P9 itself, and the ranking it induces on a complete list of ratios.
(edit: updated the table of top N2D3P9 ratios with introducing level indices, returned to undirected ratios, but oriented them properly now: viewtopic.php?p=2246#p2246)
Thanks for that.

User avatar
Dave Keenan
Site Admin
Posts: 1305
Joined: Tue Sep 01, 2015 2:59 pm
Location: Brisbane, Queensland, Australia
Contact:

Re: developing a notational comma popularity metric

Post by Dave Keenan »

Good work. Thanks. Here's my edit so far. I haven't got to the development section yet, but it looks pretty good. You will see that I changed my mind and decided, for pedagogical purposes, to describe the n≥d requirement as outside the N2D3P9 function.


N2D3P9 or Entoo-Deethree-Peenine, is a fictional character in the Star Wars franchise. In an alternative timeline, the young Anakin Skywalker assembles the droid N2D3P9 from the parts of three other droids: R2D2, C3P0 and NR-N99. Only joking.

N2D3P9 is a mathematical function which was developed to help in designing the Sagittal microtonal notation. Given a pitch ratio n/d, N2D3P9 estimates its rank in popularity among all rational pitches in musical use. A low value of N2D3P9 indicates that the ratio is used often, and so should have a simple accidental symbol, while a high value indicates that the ratio is used rarely and so can have a more complex symbol if necessary. The real reason for its name will become obvious when we describe how to calculate it.

Because factors of 2 and 3 in pitch ratios are already notated by moving along the chain of fifths (... B♭♭ F♭ C♭ G♭ D♭ A♭ E♭ B♭ F C G D A E B F♯ C♯ G♯ D♯ A♯ E♯ B♯ Fx ...) and by changing octaves, N2D3P9 only operates on ratios that have had their factors of 2 and 3 removed. For example, there are various numbers of factors of 2 and 3 in the following ratios: 16/15, 10/9, 6/5, 5/4, 27/20, 45/32, 64/45, 40/27, 8/5, 5/3, 9/5, 15/8, but when their factors of 2 and 3 are removed, they all reduce to 1/5 or 5/1, and so they can all be notated using the same microtonal accidental, pointing either up or down, combined with different letters and sharps or flats. We say that 1/5 or 5/1 is the "2,3-reduced" or "5-rough" form of these pitch ratios.

Because 1/5 and 5/1 use the same accidental pointing either up or down, and because N2D3P9 only operates on ratios whose numerator is larger than their denominator, 5/1 can represent this entire equivalence class for the purpose of notation design.

Formula

Before describing how to calculate N2D3P9, we describe two simpler functions that are used in calculating it.

We call the first one "copfr", which stands for "Count Of Prime Factors with Repeats". It applies to any positive integer. For example 175 has the prime factorisation 5 x 5 x 7, which has 3 factors, so copfr(175) = 3. copfr(1) = 0. It is also called the "big omega" function, `Ω`.

The second is "prime-limit", which is also known as "gpf", which stands for greatest prime factor. Prime-limit(175) = 7. Normally, Prime-limit(1) = 1, but because we are dealing with 2,3-reduced or 5-rough numbers, we take prime-limit(1) to be 3, although this does not alter the ranking of ratios by N2D3P9.
$$\text{N2D3P9}(n/d)=\frac{n}{2^{\text{copfr}(n)}}×\frac{d}{3^{\text{copfr}(d)}}×\frac{\text{prime-limit}(nd)}{9} $$
$$\text{where }n\text{ and }d\text{ are 5-rough positive integers and }n≥d$$
Note that where

\(n = 5^{n_5}×7^{n_7}×11^{n_{11}}×...\)

we have

\(2^{\text{copfr}(n)}=2^{n_5}×2^{n_7}×2^{n_{11}}×...\)

and so

\(\frac{n}{2^{\text{copfr}(n)}}=(\frac{5}{2})^{n_5}×(\frac{7}{2})^{n_7}×(\frac{11}{2})^{n_{11}}×...\)

and similarly

\(\frac{d}{3^{\text{copfr}(d)}}=(\frac{5}{3})^{d_5}×(\frac{7}{3})^{d_7}×(\frac{11}{3})^{d_{11}}×...\)

These can be described respectively as "product of half prime factors of the numerator (with repeats)" and "product of one-third prime factors of the denominator (with repeats)". So we can describe the procedure for calculating N2D3P9(n/d) as:

Take the prime factorization of the numerator and divide all the primes by 2, then multiply it out again. Do the same with the denominator but divide by 3 instead of 2. Multiply these two results together then multiply by the prime limit of the ratio and divide by 9.

N2D3P9 can also be written as:
$$\text{N2D3P9}(n/d)=\frac{nd⋅\text{gpf}(nd)}{2^{Ω(n)}3^{Ω(d) + 2}} $$
where `nd` is established in music theory as a ratio's "product complexity" or Benedetti height.

The division by 9 does not affect the ranking, but it has the effect that there are approximately `N` 5-rough ratios with `\text{N2D3P9}≤N`.


Development

User avatar
cmloegcmluin
Site Admin
Posts: 999
Joined: Tue Feb 11, 2020 3:10 pm
Location: San Francisco, California, USA
Real Name: Douglas Blumeyer
Contact:

Re: developing a notational comma popularity metric

Post by cmloegcmluin »

Dave Keenan wrote: Mon Aug 17, 2020 5:30 pm I note that you can omit the word "ratio" from "5-rough-ratio-no-pop-rank", as suggested here:
viewtopic.php?f=4&t=493&p=2244#nopoprank
Ah, ok. I'll be more mindful of that moving forward. It looks like in that earlier effort of yours to standardize our naming of these two layers of metric, the issue of "5-rough-ratio" vs "5-rough" didn't even come up; apparently I've simply felt compelled on some level to insert "ratio". Hence how you've put it here, "you can omit" (my italics) and "as [implicitly] suggested" before. Now that it has brought to my attention explicitly, I agree that omitting "ratio" is superior.
I've now updated the 0.11 to 0.33 in your earlier list. However I don't really see it as a "special value". I think that 3 simply is the prime limit of a 5-rough monzo with all zeros.
You have a high standard of "special", my friend! :lol: I think 1/1 having a prime limit of 3 is pretty special.

Well, how about we do give N2D3P9(1/1) a special value explicitly, i.e. we say it is defined as 1?

Okay, maybe we should talk about this a bit more. The reason I think you want to make the prime limit of 1/1 as 3 in a 5-roughened environment is this: "take the next smallest prime number after the p you have roughened to, and that should be the prime limit of 1 in a p-rough world".

I had to go back and rewatch the Numberphile video about why 1 is not prime (not linking here b/c it's slightly tedious and I'll just distill the important part here) to remind me that the reason is because the Fundmental Theorem of Arithmetic states that every whole number can be written as a unique product of primes, and if 1 was permitted to be a prime the "unique" constraint would be violated, because any product of primes could have an arbitrary count of 1's multiplied into it without changing the value.

As for why the greatest prime factor (or largest prime divisor, or prime limit) gives 1 for 1 i.e. gpf(1) = 1, I had to look that one up too. It turns out I was wrong; I built that case into my code, for whatever reason, however it looks like it is simply not defined for numbers below 2.

My suggestion, then, is that N2D3P9 is simply undefined for 1/1, inheriting this lack of definition from gpf.

Who needs N2D3P9(1/1), anyway? Aren't you using it wrong if you're wondering whether or not it's important to be able to notate 1/1 in a simple way in the Sagittal JI notation system? : D

As a bonus, we could then simplify the ≥ to >.

Edit: while that is what Wolfram seems to indicate, I did find this trusted source which says "By convention, 1 (which used to be considered prime, but is now called a unit) is sometimes given as its own greatest prime factor. Actually, 1 is the empty product (defined as the multiplicative identity, i.e. 1) of primes." Maybe this is where I got the idea to implement it that way (I even used the word "conventional" in my test description). I still like the idea of leaving N2D3P9(1/1) undefined though. Let me know what you think.
By the way, I would plan to include a table of the top 100 ratios by N2D3P9 in a Xen Wiki post.
The top 100 "5-rough ratios" or "2,3-reduced ratios", as the heading should say. In that context, I think the ratios should be given with slashes, not colons, and with the big number first. That's because we want them to be read as pitch ratios, not interval ratios.
Wow, it's fascinating how subtle deciding between slashes and colons gets sometimes. Yes, I agree with the choice for them to be slashes, to be more readily familiar to readers as pitches they might notate. Although we know that using a colon would build in the suggestion that e.g. 4:5 represented both 5/4 and 8/5, perhaps building in that suggestion is more confusing than its worth, since most readers will be able to make that inference themselves, and it's more important to play to musical conventions around what type of information ratios with slashes indicate.

Also agreed with the 5-rough ratio heading. Thanks for the improvement.
You asked me to round N2D3P9 values to two digits, but I expect most of time we can get away with zero digits, which would kind of solve this problem.
I assume you mean "decimal places" above, when you write "digits". I'm pretty sure there are some values in the list up to 136 that were distinct, but would not remain distinct, unless you keep 2 decimal places.
I did mean digits yes.
Then you are mistaken. :) I never suggested rounding to two "digits" (which could mean 2 "significant digits"). I suggested rounding to 2 "decimal places". :)

But really, I assume you just made the same thinko again. Maybe 'cause it's getting late. :) Either that, or there's some convention here I'm not aware of.
Omigosh what is wrong with me. I really ran with that thinko...

No there's no convention in American English to accompany disagreement with an affirmation, as in "I disagree, yes," if that's what you're asking ;)

Alright, shall we stick with two decimal places by convention, then?

Post Reply