Category Archives: computers

Two New Computers

Thanks to Matt for making me feel guilty about failing at blogging. Lesson: guilt is far more effective than to do lists.

I got two computers in the mail this week!

The first computer is an old Lenovo Thinkcentre that was acquired from eBay. It’s going to be the Stanford University Mathematical Organization‘s new server. We’ll use it to do a whole bunch of things, including but not limited to a number of jobs for the Stanford Math Tournament (registration, grading, and tons of data analysis). I installed Debian Squeeze last night, and it should be fully functioning within the next few days.

The second computer is a Raspberry Pi! I ordered a Raspberry Pi from RS on June 29, and after increasing amounts of frustration, cancelled that order and ordered again from Newark on July 20. After another few weeks of waiting, it’s finally here! It looks really pretty. Unfortunately, I’m still lacking various cables, an SD card, and free time, so I can’t play with it yet. With everything else that I should do this week, that’s probably a good thing. I’m still trying to decide what to do with my Raspberry Pi. Any cool ideas? Let me know!

Before I got my Raspberry Pi, I had heard that it was credit-card-sized, but I was still surprised to see how small it is. It’s amazing that something that small could have so much computing power — this computer is more powerful than the best supercomputers from only a few decades ago.

Here’s a picture of the two computers:

SUMO server and Raspberry Pi

A Live-TeXing Experiment

In the past two weeks, I’ve taken a mini-course taught by Yakov Pesin at the Penn State REU. The topic is “Fractal Geometry and Dynamics”. Instead of handwriting my notes, I tried to live-TeX notes during the lectures. This was inspired by Akhil Mathew; his thoughts on live-TeXing exist here.

The live-TeX experiment turned out much better that I thought it would. My first reaction to the idea of live-TeXing was that it would be infeasible and horribly inefficient. It seemed indisputable that I could write faster than I could type. Magically, however, I realized that my live-TeXed notes were more comprehensive and more legible than my typical handwritten notes. I thought that I would regularly fall behind while live-TeXing, but this did not happen; I rarely fell behind — certainly no more often than when I used paper and pencil. By this point, I think I’m going to live-TeX most if not all of my classes from now on.

It takes some effort to get used to Live-TeXing. The first few lectures were difficult; I struggled to keep up with all of the formulas. As the class continued, I became faster at typing and learned to think less about trivial matters such as formatting. I also used a number of LaTeX shortcuts for lazy people that sped up the typing process significantly. By the end of the class, I could keep up with even the most complicated formulae.

There are a number of benefits to live-TeXing. For example, having all of my notes on my computer means that it is less likely for me to lose my notes and (hopefully) less likely for me to spill water on them. Furthermore, they’re easier to use (because pdfs are searchable) and they save trees. With respect to content, my live-TeXed notes include all of the historical notes and heuristic remarks that I would have missed while writing manually. Furthermore, they can be read without a magnifying glass.

The main problem with live-TeXing is that it is difficult to copy down pictures during lectures; this was a particularly big problem in the fractal geometry class. I tried to describe each picture in words, though I’m sure that this was not an optimal solution. In the future, I might try to draw pictures by hand and scan them, or draw pictures in Paint. In addition, live-TeXing ended up taking up a bit more time; I spent a few minutes every evening cleaning up the day’s notes (fixing typos, dealing with formulae that run off the page, adding subsection headings). That’s probably a good thing, however; it’s good that I was forced to look back and think about the lecture.

Here are the results on my two weeks of live-TeXing. At two hours per day, this constitutes approximately 20 hours of lectures. If anyone took good handwritten notes with pictures from the class, I’d be happy to scan them and insert them into my file.

Here are the technical details of what I did to make live-TeXing happen.
Read more of this post

Analysis of the 24 Game

The 24 Game is a very simple card game. Four cards are dealt at random, and the players must apply simple arithmetic operations to the four numbers on the cards; the goal is to obtain 24 as a result of these operations. Each of the four numbers must be used exactly once, and the available operations are addition, subtraction, multiplication, and division. For example, if the cards were (3, 1, 4, 1), a solution would be (1 + 1) * 3 * 4 = 24. In the simplest version of this game, we let A = 1, J = 11, Q = 12, K = 13, joker = 15. There are four cards of each normal denomination, and two jokers.

I was playing the 24 game on Friday night, and I claimed that fractions are not necessary in the 24 game; all problems in 24 that can be solved with fractions can also be done by division. After three examples to the contrary {(1, 5, 5, 5), (3, 3, 7, 7), (4, 4, 7, 7)}, I was forced to retract my claim. Fractions are indeed necessary to solve some hands of cards in 24. This leads to some interesting questions. First of all, how many hands require using fractions? How common is this type of hand?

To answer this question, I wrote a simple Python program to bash the 24 game. Admittedly, this program is terribly inefficient and a demonstration of bad coding style, but I think I’ve worked out the bugs. Given 3.5 minutes, my program can solve the 24 game entirely: It can generate every possible hand and give a solution for each (if a solution exists). The program can also determine if there exists a solution that does not require fractions.

Here’s a summary of the results of this program:

  • There are 2366 possible hands.
  • Out of these, 617 have no solution.
  • An additional 23 require using fractions to solve.

So we see that around a quarter of all hands are unsolvable, while less than 1% of hands require fractions. Thus, in most cases, it’s not necessary to consider fractional solutions; my claim was based on empirical evidence and is true for most hands. Indeed, I suspect that most people would give up on these problems in 24 and claim that they are unsolvable; that may explain why I hadn’t ever seen a solution involving fractions until Friday night.

I’ll admit that this isn’t precisely correct; not all hands are equally likely to appear; (3, 3, 3, 3) would appear much less often than (3, 4, 5, 6), for example. However, I assume that averaged over a large number of hands, this ratio of hands is approximately accurate. Thus, averaged over all impossible hands, I assume that impossible hands occur with probability around \frac{617}{2366} \approx 26\%.

Something that was discussed during Friday’s game was the idea of treating aces as 14 instead of 1. The rationale is that in most card games, aces are larger than kings. Under this new convention, what would be the probability of getting an impossible hand? My program computed 674 impossible hands, for an average impossibility rate of \frac{674}{2366} \approx 28\%.

This doesn’t seem like a big difference, but note that most hands don’t contain aces. What if we only looked at the impossibility rate of hands that contain aces? Here, the difference is a bit larger. There are 559 hands that contain aces, and when we set aces as ones, the probability that a random hand containing an ace has no solution is \frac{154}{559} \approx 28\%, while the probability when we set aces as fourteens is \frac{188}{559} \approx 34\%. Therefore, from a practicality standpoint, more hands are solvable when we set aces as ones. The difference isn’t huge, however, so both conventions for aces are reasonable.

If you’re interested, here’s a complete list of hands that require fractions in their solutions. It’s amusing to solve these “hardest” problems in 24, though they become much easier when it is known a priori that they require fractions.

(1, 3, 4, 6)
(1, 4, 5, 6)
(1, 5, 5, 5)
(1, 6, 6, 8)
(1, 8, 12, 12)
(1, 10, 12, 15)
(2, 2, 13, 13)
(2, 2, 11, 11)
(2, 3, 5, 12)
(2, 4, 10, 10)
(2, 5, 5, 10)
(2, 6, 10, 15)
(2, 6, 15, 15)
(2, 7, 7, 10)
(2, 7, 12, 15)
(2, 8, 12, 15)
(2, 9, 10, 15)
(3, 3, 7, 7)
(3, 13, 13, 15)
(4, 4, 7, 7)
(4, 4, 6, 15)
(5, 5, 7, 11)
(5, 7, 7, 11)