Monday, October 03, 2016

Time for my annual baseball post-season history blast

I am fascinated by long-term success of baseball franchises. The fact that some teams go for decades without winning the championship is perplexing. Just intuitively, every team should win the World Series every 30 years, since there are 30 franchises. That does not happen.

I decided to create a "Championship Frustration" index to measure every World Series by. This is the total number of seasons that have been played by both teams not counting the season in question. So, the Frustration Index of the Chicago Cubs for 2016 is 2016 (current season) - 1908 (the last time they won) - 1 (not counting the current season) = 107. Still the all-time high... and it's not close. For the Texas Rangers, they started playing in 1961 (in Washington), so the index is 2016 - 1961 (or, really, we assume the year before the franchise started is the last win, 1960 - 1), or 55.

Here are the top-ten World Series sorted by "Championship Frustration":

1. 2005 - Chicago White Sox (won in 1917, FI 87) vs. Houston Astros (came into league in 1962, FI 43) = 130
2. 2004 - Boston Red Sox (won in 1918, FI 85) vs. St. Louis Cardinals (won in 1982, FI 21) = 106
3. 2010 - San Francisco Giants (won in 1954 while in New York, FI 55) vs. Texas Rangers (came into league in 1961 as Washington, FI 49) = 104
4. 1975 - Cincinnati Reds (won in 1940, FI 34) vs. Boston Red Sox (won in 1918, FI 56) = 90
5 (tie). 1980 - Philadelphia Phillies (had not won; series started 1903, FI 77) vs. Kansas City (came into league in 1968, FI 11) = 88
5 (tie). 2002 - Anaheim Angels (came into league in 1961, FI 41) vs. San Francisco Giants (won in 1954 while in New York, FI 47) = 88
7. 1986 - New York Mets (won in 1969, FI 16) vs. Boston Red Sox (win in 1918, FI 67) = 83
8. 1995 - Atlanta Braves (won in 1958 while in Milwaukee, FI 36) vs. Cleveland Indians (won in 1948, FI 46) = 82
9. 1972 - Oakland Athletics (won in 1930 while in Philadelphia, FI 41) vs. Cincinnati Reds (won in 1940, FI 31) = 72
10. 1987 - Minnesota Twins (won in 1924 while in Washington, FI 67) vs. St. Louis Cardinals (won in 1982, FI 4) = 66

So, let's look at the FI for all of the playoff teams:

National League:

Chicago Cubs (won in 1908) - 107
Washington Nationals (came into league in 1969 in Montreal) - 47
New York Mets (won in 1986) - 29
Los Angeles Dodgers (won in 1988) - 27
San Francisco Giants (won in 2014) - 1

American League:

Cleveland Indians (won in 1948) - 67
Texas Rangers (came into league in 1961 in Washingotn) - 55
Baltimore Orioles (won in 1983) - 32
Toronto Blue Jays (won in 1993) - 22
Boston Red Sox (won in 2013) - 2

So, if the Cubs go the World Series, if they play Cleveland, Texas or Baltimore, this will be World Series with the most frustrated fans. Without the Cubs, it won't be the most frustrating, but it has the great potential of making the top ten.

Unless we get the Giants vs. the Red Sox. Yawn.

Tuesday, September 20, 2016

Apple frustrations

So I have a beef with Apple and the way it works.

I find a problem with an Apple product. I get angry. But these things happen. Software is software, and there will be bugs.

When they are serious or annoying enough, I look for workarounds on the Web, and I usually find them. I find them all over the Apple Developer Forums. I find them in Mac or iPhone blogs. I find them on Twitter. I find many people who have these problems.

When I then mention them, I am told by (very nice and polite and friendly) friends who are Apple employees to file a bug. That Apple only notices when people outside of Apple files bugs.

That process is somewhat painful. It takes at least 15 minutes, and often much longer, to give enough detail to describe the bug effectively.

When the bug is filed, if Apple pays attention, I am asked to spend another amount of time, sometimes several hours, and freeze the state of my machine so that over the next few days or weeks, more probing questions about the state of whatever it is can be asked.

And then the bug is usually marked as a Duplicate. And the only visibility from this point forward is whether or not the bug that it duplicates is still open.

So. Why, as a paying customer, am I being asked to do free QA work for a bug that Apple already knows about?

I have it on good authority that the fact that a bug is filed from an outside person is given more weight that an bug filed inside of Apple. That authority is me; we certainly did that when I was there.

But I some other problems with this:
1. It marginalizes the Apple employees who do file bugs, or at least it marginalizes the QA work they already did. Apple people can find the bug much closer to when it is introduced that the general public. It could be months before any betas even ship out. It also gives a negative incentive for employees to file a bug on their own code; they are penalized for having the bug, and they never get to see it fixed until it becomes a public problem.

2. Why is it that the fact that the tech press, blogosphere, Twitter-sphere and forum audience are basically ignored on this? When I can literally find a dozen descriptions of the bug that are every bit as good as mine out in the wild, why do I have to file a bug for it to be paid attention to?

In its defense, Apple has a LOT of software, and has a relatively small engineering staff generating and maintaining it. That is what helps keep Apple as nimble as it is. But the attitude of "we'll fix it when the public complains enough in ways that we define (and are obtuse)" makes me insane.

My friends who are Apple employees, I am not mad at you. I am an Apple fanboy from wayback. I am a former employee. Thank your for your hard work.

I just wish this aspect of how Apple works would change.

Wednesday, August 24, 2016

Why F# is not the same as Gb

When a guitar string is plucked, a standing wave is set up, with a node of the wave on either end of the guitar. This is the fundamental note for the string of the guitar. The wavelength is twice the length of the guitar. The frequency is determined by the material of the string and the tension in the string. However, provided neither the tension of the string nor the length of the guitar changes, a given string will always sound at the same frequency when played open.

When a finger is placed lightly on the string halfway between the end points of the guitar and the string is plucked, a standing wave is set up with nodes at either end plus another in the middle. This wave has a wavelength that is the length of the guitar. When you halve the wavelength, all other factors being the same, the frequency is doubled. That is to say, the wavelength and frequency are inversely proportional. I won't go through the trigonometry of this, but basically, the wave is a sine wave, and the mathematical properties that go with a sine wave apply here also. Oh, and the note sounds an octave higher than the fundamental.

When a finger is placed lighty one third of the way between the ends of the guitar, and standing wave is set up also. It has nodes at the end points, and where the finger is placed. It also has one at the symetrically opposite position. Since the only wave that has a node where the finger is placed has a wavelength one-third of the fundamental wavelength, this is the standing wave that is set up in the string, which means that the other side also has a node. Since this wavelength is one-third of the length of the fundamental wave, the frequency is three times the frequency of the fundamental. The note that is produced is one octave and a perfect fifth higher than the fundamental.

This series keeps going. At one-fourth the distance, the note is two octaves higher. At one-fifth the distance, it is two octaves and a third, etc.

This applies not only to strings, but also woodwinds, brass and percussion. It also applies to resonance in any medium. The overtone series, as it is called, is also present with light waves.

So, if we look at this, we notice that the interval between the first and second harmonic in this series is a perfect fifth. Remember, the first harmonic is an octave higher than the fundamental, and the second harmonic is one octave plus a perfect fifth higher. If x is the frequency of the fundamental, then 2x is the frequency of the first harmonic and 3x is the frequency of the second harmonic. This means that the ratio of the frequencies of the first and second harmonics is 3x/2x, or 3/2, or that a note is a perfect fifth higher than another note if the frequency of the second note is 1.5 times the frequency of the first note.

If we then apply the cycle of fifths over and over again, we get the following sequence. Assume that we have a low C with a frequency of x Hz. Then we have:

Note Frequency
Fund. C x
1st 5th G 1.5 * x
2nd 5th D 1.5 * 1.5 * x
3rd 5th A 1.5 ^ 3 * x
4th 5th E 1.5 ^ 4 * x
5th 5th B 1.5 ^ 5 * x
6th 5th F#/Gb 1.5 ^ 6 * x
7th 5th C#/Db 1.5 ^ 7 * x
8th 5th G#/Ab 1.5 ^ 8 * x
9th 5th D#/Eb 1.5 ^ 9 * x
10th 5th A#/Bb 1.5 ^ 10 * x
11th 5th F 1.5 ^ 11 * x
12th 5th C 1.5 ^ 12 * x

This cycle of fifths covers seven octaves. A note is an octave higher than another note when the frequency is doubled, so given x above:

Fund. C x
1st 8va C 2x
2nd 8va C 4x
3rd 8va C 8x = 2 ^ 3 * x
4th 8va C 2 ^ 4 * x
5th 8va C 2 ^ 5 * x
6th 8va C 2 ^ 6 * x
7th 8va C 2 ^ 7 * x

Now, the highest C we have here we have derived by two different methods. Since is is theoretically the same note, they should be the same frequency. But they are not, since 1.5 ^ 12 <> 2 ^ 7.

This is the simplest case; it gets really messy when you are tuning a piano. Using the overtone series, a perfect fourth has a ratio of 4:3, a major third of 5:4, and minor third of 6:5, and a whole step of 8:7. Half-steps don't really fit. All of these do not propogate well when tuning. Tuning one key is fairly straightforward. Tune the fundamental and all of its octaves. Tune the fifth. Tune the fourth. Tune the major and minor third. Then use the existing notes with fourths, fifths and thirds to tune the rest of the notes. You will then have something which sounds great in the fundamental key, but terrible in non-closely related keys.

To solve this problem, the tempered scale was developed. Instead of the overtone series, the tempered scale is based on dividing the octaves into twelve equal pieces pitchwise. Each piece is then defined to be a half-step, and all of the notes are derived that way. This means that all of the intervals are just a hair flat, but the music can be played in any key and be equally out of tune.

Mathematically, we are mapping a linear set of pitches onto the logarithmic scale of frequency. Let's assume you have a pitch of freq. x. The octave is 2x. You need to find a linear mapping of this to the chromatic scale. So basically, we need to find a value y that when x is multiplied 12 times, the resulting value is 2x.

x*(y ^ 12) = 2*x

Divide by x

y ^ 12 = 2

y = 2 ^ (1/12)

So, to go up a half a step from a note with frequency x:
y = 2 ^ 1/12 * x

There are seven half steps in a fifth (C-C#, C#-D, D-D#, D#-E, E-F, F-F#, F#-G), so to get a note that is a fifth higher, we do the following:

Fund C x
1st C# 2 ^ 1/12 * x
2nd D 2 ^ 1/12 * 2 ^ 1/12 * x = 2 ^ 2/12 * x
3rd D# 2 ^ 3/12 * x
4th E 2 ^ 4/12 * x
5th F 2 ^ 5/12 * x
6th F# 2 ^ 6/12 * x
7th G 2 ^ 7/12 * x

So a note a fifth higher is 2 ^ 7/12 * x.

Applying that to the circle of fifths:

1st C x
2nd G 2 ^ 7/12 * x
3rd D 2 ^ 7/12 * 2 ^ 7/12 * x = 2 * 14/12 * x
etc.
12th C 2 ^ 84/12 * x = 2 ^ 7 * x

and we have matched frequencies.

Fun with spreadsheets. Let's say that our fundamental is a C with a frequency of 100 MHz. The seven octaves mentioned above would be:

0 C 100
1 C 200
2 C 400
3 C 800
4 C 1600
5 C 3200
6 C 6400
7 C 12800

Now, let's show both cycle of fifths:

Note Untempered Tempered
C 100.0 100.0
G 150.0 149.8
D 225.0 224.5
A 337.5 336.4
E 506.3 504.0
B 759.4 755.1
F#/Gb 1139.1 1131.4
C#/Db 1708.6 1695.1
G#/Ab 2562.9 2539.8
D#/Eb 3844.3 3805.5
A#/Bb 5766.5 5701.8
F 8649.8 8543.0
C 12974.6 12800.0

The reason the overtone series is so important is that musical instruments are made to resonate at a fundamental frequecy. They also resonate on frequencies close to them in the overtone series. If you open the pedal on a piano, strike a note and dampen it with your finger, a whole lot of strings will resonate, especially the ones that are octaves lower than the note. The ones that are a fifth away will resonate less loudly, a fourth away, less loudly etc. This phenomena is present will all period resonance. As an experiment one night, go out to your car. Find a low frequency AM radio station and set the preset for it. Then tune to twice the frequency and set it. Switch back and forth. As long as there is not another station interfering, the station should come in loud and clear at twice the frequency; in other words, up an octave. The crystal is vibrating with harmonics.

Feel free to distribute this to whomever you like, but leave my name on it.

Syd Polk