Pages

Saturday, January 18, 2020

Ocular Observatory


While walking Lorna one morning this week, I noticed the Sun and Moon in the sky at the same time, and I started wondering what sort of information I could get about the Solar System based only on some simple measurements of their positions. The picture I had in my head was this:
Earth-Sun-Moon System (Not to scale)
As long as they're both visible, we can measure the angle between the Sun and the Moon with a compass. What occurred to me though is that we can also measure the angle between the Sun and the Earth by looking at the phase of the Moon:

Based on Wulffnet from Wikipedia
We can translate that length into an angle with
With two angles, we know the third, and we can relate them to the sides using the Law of Sines (and some other trig identities):

It also occurred to me that, because the Sun and Moon have similar angular sizes, which allows us to get solar eclipses, we can relate these distances to the relative sizes.
where r is the radius of the Sun/Moon.

Unfortunately, once we try to put some numbers in here, the my idea of "primitive astronomy by eye" breaks down: The actual ratio of distances for the Moon and Sun is about 0.0026, which means you'd need to get the angles within about a tenth of a degree. Thinking about this type of analysis makes me respect people like Galileo and Copernicus all the more.

Sunday, January 5, 2020

Mathematics: The Shuffling

Recently, my brother-in-law Alex has been into the card game Magic: The Gathering. Over the holidays he had the whole family playing, and the question came up of how many times a deck needs to be shuffled to be "random". For an ordinary 52-card deck, the oft-quoted result of 7 was originally given in a New York Times article from 1990. Doing a bit more research, I found a paper following up on that article with a few more details. I wasn't entirely satisfied with that, both because the shuffles described didn't quite match my techniques, and because I found the probability calculations difficult to follow in my first jet-lagged, and now sickened state, so I wrote some code to simulate a series of shuffles. The two types of shuffle I usually do are:

Riffle: Split the deck in two, and interleave the piles, roughly alternating. I modeled this as a split using a Gaussian distribution around the center, and then picking from the two piles with 50/50 chance.

Overhand: Holding the deck in one hand, move packs of cards to the other. I modeled this as splitting the deck into a set number of unequal packs, and reversing the order of those packs.

Now we have to figure out the quality of these shuffles. I've talked about one way to measure randomness before, but that doesn't really apply here, since all the cards (in a standard deck anyway) are unique. For a deck labeled 1-52, the two quality measures I came up with are: the total number of cards in sequences, and the distance of each card from its original position. Over a series of shuffles, here are the means and standard deviations for those two measures on a set of 5000 decks:


For both distance measures, the riffle shuffle appears to reach a stable value in fewer shuffles. Breaking up runs is clearly not a strong suit of the overhand shuffle, but it moves cards from their original position pretty quickly. As far as the minimum number of shuffles though, it appears 7 is a reliable choice, but you could get away with fewer on average.

Monday, December 23, 2019

Yabba-dabba-doo!

Coming back to Michigan means going to the gym again! I'm always interested in the energy measurements given by the machines – Calories are a unit of energy, but with a capital "C", they're actually kilocalories, with a lowercase "c". Here's a 30-minute workout on the elliptical:

This says I burned 268 Calories to go 2.43 miles, or 0.009 miles/Calorie.

A few years ago, my parents got the all-electric Chevy Bolt, which also shows the energy used to go a distance, and so I was curious to see how I stack up to their car in terms of efficiency. I asked Sally to send me a photo of one of the status screens:

The number we're interested in is the 3.0 miles/kilowatt-hour. Kilowatt-hour is another unusual measurement of energy, since Watts are energy per time (specifically Joules per second) which we multiply by a time to get back to energy.

To compare these two, we can convert the units to match: 0.009 miles/Calorie = 7.74 miles/kWh, meaning running on an elliptical is 2.58 times as efficient as a modern electric car! You might be thinking a new charging method is in order...
Giphy

...unfortunately, the energy demands of hauling a car around are a bit higher than your own body, as shown by another status screen:

The total energy of 22.4 kWh comes to almost 20,000 Calories, which I don't think is in the range of many humans!