Tag Archive: math

Bouncing screensaver

July 31, 2013 1:59 pm Published by Leave your thoughts

We’ve all seen the bouncing screensaver. And we’ve all watched, hoping it would fall into the corner. Oh, you haven’t? Well, watch this documentary footage of the adventure you’ve been missing.

The screensaver isn’t mysterious. It moves in predictable ways, meaning we can calculate how often it’ll hit the corner (and if it will hit a corner). So let’s start with some assumptions.

  • The bouncing object is smaller than the screen.
  • It starts in the upper left hand corner.
  • It moves at a 45 degree angle.
  • It bounces perfectly (i.e. it always is moving at a 45 degree angle).

(more…)

Expected ERA

September 13, 2011 1:03 pm Published by 2 Comments

Imagine two hypothetical pitchers. Their ERAs are very close together and both pretty average: 3.40 and 3.41. They’ve both pitched just over 200 innings in 30 starts with just a couple weeks of the season remaining. But one pitcher has had some pretty advantageous matchups: he’s played the Padres four times, the Reds and Rockies twice each, the Pirates, the Mets, the Royals — all teams with records under .500. The other pitcher, on the other hand, has had a harder schedule: four games each against the Yankees and the Red Sox, two against the Rangers, and one in Detroit. Are these equivalent pitchers?

I set out to determine if pitchers we accept as “elite” are truly that great, or if some might have an unfair advantage due to schedules. I downloaded all of MLB’s gamelogs for the 2011 regular season up through yesterday, and then I parsed them, tracking a few key pieces of information. First, the number of innings each pitcher pitched against each team. Second, the average number of earned runs each team scores per inning. Then, for each pitcher, I calculated what their ERA would be if they allowed exactly their opponent’s average for each appearance. Here are the results (for pitchers who have enough innings pitched to qualify for the ERA title):


Expected ERA – after 2011-09-12

One interesting takeaway is that there aren’t any huge surprises. Of the pitchers with the ten best actual ERAs, only one of them (Cole Hamels) isn’t in the top ten for the best differential. Another interesting fact is how much a pitcher’s expected ERA is affected by simple rotation timing, and not just the team’s schedule. The Phillies have played against a lot of sub-.500 teams this year, and Cole Hamels has one of the lowest expected ERAs. But his teammate Cliff Lee hasn’t been so lucky — his expected ERA is higher than most.

But there are some people who get a nudge from good to great with this analysis. Oh, and those two hypothetical pitchers I mentioned? They aren’t hypothetical. They’re Daniel Hudson of the Diamondbacks and David Price of the Rays, respectively. This puts a little context on the fact that Price’s record is 12-12 and Hudson’s is 16-9.

Solitaire probabilities

October 10, 2007 9:12 am Published by 1 Comment

For some reason, I’ve been thinking about Klondike solitaire probabilities a lot lately. Primarily, I’m wondering what the likelihood is that a game will have zero legal plays. I’m certain it happens, but it’s got to be pretty rare. It’s a complex game, though, so here’s my plan towards solving it:

  1. Given two non-ace cards, what is the chance that one cannot be placed on the other, using standard Klondike rules?
  2. Given three non-ace cards, what is the chance that none can be played on any other?
  3. Given seven…?
  4. Given two (three, seven) cards, what is the chance that there is no legal play (placing one on another or moving an ace to the foundation)?

There are more steps after that involving the eight deck cards, but it gets pretty complicated pretty quickly. I’ll be happy just getting this far.