Regarding instrument tuning, before the development of equal temperament, instruments were generally *not* tuned to equal temperament, but would select a temperament for the key the music was written in, usually resulting in integer ratios between the notes in the keys. The downside of this is that the instrument could only be tuned for a handful of keys at a time, because you can’t separate all 12 notes with integer ratios at the same time.

Stringed instruments could still play in multiple keys, but the musicians wouldn’t put their finger in the same place each time - they would play by ear, naturally landing on integer ratios, not equal ratios. A “C” in one key would be played at a different frequency than a “C” in another key, though in equal temperament they should be the same note.

When people learn to play a stringed instrument by ear, rather than formal instruction, they often have difficulty playing alongside pianos, because in equal temperament every note has a little error from the ideal ratio - that is the sacrifice for being able to change keys without retuning. This little bit of error was hugely controversial at one point, and resulted in everything from accusations of devil worship to threats of murder.

As someone who clearly likes to pull the veil back a bit, the world of temperaments could prove a deep rabbit hole for you.

]]>And this leads to my second point: I don’t think the dog whistle Trump is tootling here has anything to do with killing a president. Except for the most extreme among them, the rank and file of the right wing militant gun nuts don’t cotton much to assassination as a tactic in dealing with political opponents. What they do have a fondness for, however, is the quaint notion of armed resistance to an intrusive, tyrannical government. After all, the old NRA slogan reads “I’ll give you my gun when you pry it from my cold, dead hands,” not “If you come for my guns I’ll shoot your elected officials.” I think this is what Trump’s verbal hash was alluding to, and I suspect it’s the dog whistle his intended audience heard.

]]>]]>The need for a systematic method to cover a range with the fewest terms first occurred to the French engineer Colonel Charles Renard (1849-1905), between 1877 and 1879, when he made a rational study of the elements necessary in the construction of captive balloons. He found that 425 different sizes of cable were used for mooring purposes and, in working on various systems for the reduction of this variety, he finally developed a sizing system based upon a geometric series of values for mass per unit length, which only required 17 cables to cover the total range.

So I was pleased to see you describe the 12-ET tuning system. I felt special enough just knowing I worked with the 12th root of 2 in my daily life, now I know I also work with the 29th root of 92!

]]>These logarithmic scales provide a nice way to work with logarithms without actually doing the logarithm calculation. For instance, the equitempered semitone scale gives a nice way to approximate products of some fractions with small numerators and denominators, which works by approximating ratios of logarithms of these fractions by fractions. (Whoa.) There are scales with 31 tones per octave, but I don’t think 39th roots will make any easier for composers to find harmonies.

]]>Haskell is a special case. As a “lazy” language, it doesn’t evaluate arguments until the values are needed, whereas all the other languages I discuss here are “strict,” evaluating all arguments before the function is applied to them. I’m a little vague on the exact mechanics of this, but I think it means that Haskell can sometimes avoid growing the stack without actually doing tail-call elimination.

More conventional tail-call optimization has been a feature of Scheme since before 1980, and it has been standard in most other Lisps since the 1990s. Lua also does it, and the new JavaScript (ES6.0). The LLVM compiler framework, which is Julia’s infrastructure, is equipped to do tail-call elimination, and indeed it provides that option for C programs in the clang compiler. The Julia developers have so far decided not to implement that optimization.

In saying all this I don’t mean to suggest that the Julia folks have made the wrong decision here. I don’t know nearly enough about the tradeoffs to make that judgment. I’m just saying that I’d like everything Julia offers already, plus tail recursion (and also a pony, please).

]]>Here are a couple of your examples in Haskell.

factorial n = product [1 .. n]

she_loves_me petals

| petals == 0 = True

| otherwise = she_loves_me_not (petals - 1)

she_loves_me_not petals

| petals == 0 = False

| otherwise = she_loves_me (petals - 1)

Neither had any problem executing

> factorial 21

51090942171709440000

> she_loves_me 1000000

True ]]>

factorial n = product [1 .. n]

she_loves_me petals

| petals == 0 = True

| otherwise = she_loves_me_not (petals - 1);

she_loves_me_not petals

| petals == 0 = False

| otherwise = she_loves_me (petals - 1)

Neither had any problem executing

> factorial 21

51090942171709440000

> she_loves_me 1000000

True

But there is still an issue if if you make a foo(::Number) and then do a type-conversion of all of the numbers to a concrete type. It still works by multiple dispatch, but if at the top you type check and convert things to either Floats or Rationals depending on whether what comes in is an Integer or Float, then you’ll have a type instability. Instead you should make your function call a function which works on foo(::Number) without having to do any conversions and it will optimize via multiple dispatch. See “Separate kernel functions” in http://docs.julialang.org/en/release-0.4/manual/performance-tips/ .

So I should’ve added a detail: at the bottom each dispatch had to be defined, but when you build up, you have +(::Number,::Number) and the like already defined on each number, so if you just call +, the compiler will be able to choose the right + function and make it efficient (if your types are stable).

]]>