Wikipedia:Reference desk/Archives/Mathematics/2011 August 12

= August 12 =

Can this be solved / approximated tractably?
We have a set of linear constraints and the following objective:


 * Minimise $$\sum_i \frac{1}{X_i^2}$$

Furthermore, the constraints ensure that $$\forall i: X_i \in [1,\infty]$$; note that the variables can also take on an infinite value. Is there any chance of being able to solve this tractably (possibly by convex optimisation)? If not, what about approximation, perhaps by a series of runs of a solver?

If someone can give me a pointer, this is much appreciated. Thanks! Oliphaunt (talk) 07:54, 12 August 2011 (UTC)


 * Do you want a general solution for any set of linear constraints or is there a specific set you are interested in? If so, please tell us them. There might be a simpler solution if we don't need to work with complete generality. --Tango (talk) 10:14, 13 August 2011 (UTC)


 * Thanks for your reply. There's indeed a specific set; they're rather simple.  First, the Xs are in fact indexed by two dimensions, both ranging from 1 to n, and the summation in the objective function is over all $$n(n-1)/2$$ of them; we then have
 * $$\begin{align}

\forall iK: \quad & Y_{iK} + Y_{Kj} \leq Y_{ij} \end{align} $$
 * The first three together imply the domain for the X variables. The third is just the triangle inequality.  In the fourth, some of the constants may in fact be positive infinity (i.e. some of these constraints can be omitted).  In the last, K could be assumed w.l.o.g. to equal $$\lfloor n/2 \rfloor$$.
 * This problem is probably convex, right? What I'd like to know is how to go about solving (or approximating) it.  We don't have to squeeze out every last bit of speed; we'd just like to find a solution.
 * We've solved this for a different (linear) objective function before (using GLPK) and I'd greatly appreciate a pointer for how to deal with this objective. What approach / solver would you use?  Thanks! Oliphaunt (talk) 20:28, 13 August 2011 (UTC)

musical notes
Why are there 7 keys in an octave of a musical scale in place of 12 equally spaced(mathematically) keys? — Preceding unsigned comment added by 113.199.189.86 (talk) 11:38, 12 August 2011 (UTC)


 * Things sound better if the pitches are spaced multiplicatively rather than additively, but the twelfth root of two is irrational. The pitch intervals were originally small integer ratios; see Just Intonation for more information. Bobmath (talk) 14:28, 12 August 2011 (UTC)


 * A musical scale is just a subset of the available tones chosen because they have some musical relation. A lot of Western music stays mostly within some major or minor scale, so it makes some sense to use a writing system where the particular tones in that scale are emphasized.  This seems like more of a music theory question than anything. Rckrone (talk) 15:25, 12 August 2011 (UTC)

Assuming that the question refers to musical keys (rather than piano keys), there actually are 12 distinct, equally spaced, major keys. Each key uses 7 notes per octave -- those notes are chosen because they harmonize well with the base note (tonic) of the key. Looie496 (talk) 16:17, 12 August 2011 (UTC)


 * I'm not sure what the rules on cross-posting are, but I know I would prefer if you would at least mention you posted the question elsewhere Rosilisk (talk) 16:23, 12 August 2011 (UTC)


 * A big factor is the rational approximation of log23. You want the notes to be approximately equally spaced, which you get exactly with equal tempering, but you also want harmonic intervals such as the fifth, with a frequency ratio of 3:2, to be represented. If the scale is divided into n equal parts, so the intervals are all 21/n, and the fifth is m of these intervals, then you want 2m/n approximately equal to 3/2, or m/n≈log23−1. The best rational approximations of log23 are 8/5, 11/7, 19/12, 27/17, 65/41, 84/53, ... . Note that the first two denominators are the number of notes in the pentatonic scale the Diatonic scale. From this it appears that a 17 note scale is possible as well. So 12 notes isn't completely arbitrary but it's not out of the question to have other possibilities. A big factor is culture, we've been accustomed to hearing a 12 note scale for at least the better part of a millenium, and equal tempered chromatic scale since Bach, so whether it's arbitrary are not it's pretty much set in stone, though some avant guarde composers have experimented with 24 note scales and other ideas. Non-Western cultures sometimes use different numbers of notes as well, or the whole concept of a scale may be meaningless in some cultures.--RDBury (talk) 16:49, 12 August 2011 (UTC)


 * The question is kind of like asking why the English alphabet uses 24 letters. It works, the number is not too big or too small to be useful. And we're extremely used to it. But to a significant degree the number is also an accident of history. Other musical traditions have different ways of making and counting scales, and even Western music did not always have the simple 7 (letter name) notes per octave it does now. Pfly (talk) 00:24, 13 August 2011 (UTC)


 * 24=26. --COVIZAPIBETEFOKY (talk) 01:26, 13 August 2011 (UTC)
 * Doh! Hah, musta been thinking of the 5 note scale too... Pfly (talk) 02:34, 13 August 2011 (UTC)


 * Here's a chart showing the lowest errors you can get in perfect fifths (3:2) and also major thirds (5:4) (which is the next most important interval, at least in western music - ignoring the perfect fourth, which is just the inverse of the perfect fifth). As you can see, there are several numbers of notes that allow for a good perfect fifth, but most don't also have a good major third. 12 notes does, which is probably why we use it. It looks like 19 notes might also work quite well (and, in fact, it's apparently used enough to have its own article: 19 equal temperament). You can also see from the chart why 22 equal temperament has seem some use. There are larger numbers of notes that are also apparently quite good, but I arbitrarily stopped my chart at 25. --Tango (talk) 11:01, 13 August 2011 (UTC)