π Day programming activity

1 Comment

In our math club this afternoon, since it’s π day, I’m going to try to lead an activity where we write a program (on the Raspberry Pi, of course) that computes π. The idea I thought of (but we’ll see what the students think of as well) is to use the Monte Carlo method – guess random points (with uniform distribution) in a 2r x 2r square, and compute whether they’re “inCircle” or not (whether the distance from the center of the square <= r). Then use algebra to solve for the unknown quantity π in the formula

π r2 / 4r2 = inCircle / totalPoints

In my little Python program that does this, it pretty quickly gets to 3.14, but doesn’t get much further. Since these are 4th – 8th graders, I thought I should focus on techniques that have an intuition behind them, so Ramanujan’s fancy equations are out of the question. I’d be keen to hear other suggestions!
More

Advertisements

Wonderful math educational materials

Leave a comment

Speaking of crypto treasure-hunts and math circles…I just found these educational materials from the NSA. There are dozens of lesson plans for topics ranging from probability to geometry. They’re very complete, including clear instructions for the teacher (or parent, or math circle leader for that matter), and nice activities to print out for the students.

Between this, Wolfram’s recent re-dedication to K-12 education, and KenKen, this has been a fruitful month for me in the math education quest.
More broadly, I’ve found the matheducation reddit page to be a very useful place to discover stuff like this.

Read and post comments | Send to a friend

Crypto-treasure hunt birthday party: a great success!

Leave a comment

I was surprised to hear Audra wanted “codebreaking” to be the theme of her party this year. Maybe she missed math circle, or maybe there’s cryptography in the air, maybe she knew it would bring Dad even more into the party preparation than normal (last year’s Pirate Party was also

a hoot to design).

Codebreaking is pretty abstract, so I knew we’d need something to drive the activity.  Treasure hunts are always fun (for parents and kids), so that seemed a natural combination. Over the days before the party, I thought of the collection of codes and activities we could put together. I knew it would be great to send kids home with something to remember the party by, so I designed a “secret agent ID badge”, and a “Top Secret Code Breakers Manual”. [pdf link]
Sally Browning, one of my friends and colleagues at Galois, had prepared a codebreaking tutorial for some visiting middle-schoolers, and as part of that, she prepared a “scytale” (sounds like s + “Italy”) activity – a bunch of dowels with different diameters, with ribbons to wrap around.  Heidi had found a simple substitution cypher for the invitation (some of our great attendees replied in code — I love it!)  And from there, I pretty much had a template for the activity.
The party started at 1:00. I started working on the final treasure hunt at 8 AM that morning. I finished just in time (!). All told, I think I spent 8 hours working on the treasure hunt activities. As often as possible, I tried to make the activities parallelizable among the 10 guests…this worked mostly, and it was definitely obvious when there was a one-person bottleneck to an activity.
Heidi and I agreed that we’d try to keep the tenor of help provided along the lines of “math circle”, which is pretty much hands-off, but perhaps with a few Socratic questions thrown in to accelerate things if needed.
Here’s the sequence of the treasure hunt:
Audra took a photo of each guest as they arrived.

  • We put out puzzles and thinking-activities from our “games and puzzles drawer out for people to play with as the party gathered. We also left out a set of the “code books”.
  • When everyone assembled, we said “instead of a cake, all we have here is this empty-feeling box”.  Inside the box were two ribbons with letters on them. The kids figured out that dowels would be needed, and thought of wrapping the ribbons around chair legs or other cylinders around the house…not noticing the pile of 10 dowels against a wall.  Eventually, the dowels were discovered, and one ribbon got decoded on the first try — what are the odds?  It took a lot more work to decode the second ribbon. Between the two ribbons, the message was “I have hidden your stuff in a secret location. You will find help where les oeufs are produced.” The two French dictionaries were sitting next to where the empty box started ended up helping out.  “The Chicken coop!” and they were off.
  • Inside the coop was a plastic egg with two smaller eggs nested. In that was a tiny USB thumb drive. I created a bunch of directories (A-Z) and a “readme.txt”.  The file said “Look in directory “D” for the next clue”. Inside directory D were another set of directories A-Z, and a readme.txt that said “What “are” you looking for”.  Inside directory “R” was another readme.txt: “what are “you” looking for, again?”.  Inside directory “U” were more directories, and a readme.txt: “mmmmmmmmmmm…I love cake.” Finally, inside directory “M” was a file that said “you’ve found the right place.”
  • The innermost directory (note the path was “D/R/U/M”) had a text file with morse code spelling out “The next clue is hidden inside an instrument you hit with your hands.” as well as an .mp3 file with morse code spelling out “DRUM”. I used this web site to generate the two files. The cryptographers broke into two groups, one group tried to decode the audio, the other asked me to print out the morse code for them to decode.  Even though I slowed the morse code audio way down, that team finally switched to decoding the text as well. Nobody noticed the path spelled out DRUM. Interesting!
  • Inside the drum was an envelope with a bunch of slips of paper in the original transposition code (I wrote a python program to generate this… see the bottom of this post). I wanted to allow this task to be parallelized, so I wanted to chop up the message into bits, and then added numbers so they’d know which order they went in. The slips decoded to the text “ONE LOOK”, “TWO UNDER”, “THREE THE THING”, “FOUR THAT HANGS”, “FIVE ON ROPE”, “SIX FROM A”, “SEVEN TREE AND”, “EIGHT CHILDREN”, “NINE PLAY ON”, “TEN FOR FUN”.  They quite quickly decoded the individual strips, but had a dickens of a time figuring out the ordering of the slips. They were thinking the numbers were another level of code, or were part of the message, or formed a more complex pattern (like 2 4 6 8 …).  Finally, they got them all on the floor at once, and with a little Socratic questioning help, they figured it out. “The Swing!”
  • Under the swing was an envelope with what caused the funniest moment of the party (for me, anyway). I wrote “Hermione shows up with fancy hair and a dress.” With no time at all, the rushed into the house, grabbed the single volume (book four) of the Harry Potter series, and took about 30 seconds to find the right chapter. On that page was another slip of paper, this time with another book title, and a math problem (110 * 3 – 10).  And so on for eight books. The last slip of paper was in an art book, on the page about Miro. They discarded the book before noticing the slip of paper said “look behind a painting that looks like this one.” They dug it back out, found the page, and behind the painting was another envelope, holding a paper saying “four legs eats here”.

“Cat bowl!” Under the cat bowl were two more scytale ribbons “Oh, no, not more?!?!”.  They were getting hungry for cake.  The scytale ribbons had a little-bit-too obscure clue (I think I was getting tired at this point in the puzzle-making process): Ribbon one: “Your next clue is hidden inside a musical instrument on the West wall of the house” and “If you go to Hawaii you will hear my strings”. It took way too long to find the Ukelele on the West wall of the house. I was busy upstairs laminating the ID cards, but heard the excitement of finding a slip of paper with the URL http://www.cheapimpostor.com/mecodegoodsomeday/secretCode. Heidi says she had to help them with the typing – theirs was too error-prone to get it right.

  • They recognized bits of the car, and my car-key’s bike-chain keyring. They finally found the cake in the trunk…but no goodie bags!  Fortunately, the icing had morse code (“Not again!”) that said “look under the bed” which is where they found their goodie bags.

Heidi heard more than one guest say “this is the best birthday party ever!” which blew me away, but totally reinforced the theme of a book I’ve been reading (

A Theory of Fun for Game Design, by Ralph Koster), which is that real “Fun” comes from the excitement of actually learning something new.

All told, it took 2.5 hours to solve the clues, and they just got to the cake as parents arrived to pick them up. It was an exhausting, but very rewarding, party.
As an aside, here’s the shell script I used to create the maze-on-thumbdrive (watch out – it’s slow, and the result takes up a lot of space!):
#!/bin/sh
export digits=”A B C D E F G H I J K L M N O P Q R S T U V W X Y Z”
for i  in $digits; do
mkdir $i
cd $i
cp /tmp/readme.txt .
        for j in $digits; do
                mkdir $j
cd $j
cp /tmp/readme.txt .
        for k in $digits; do
mkdir $k
cd $k
cp /tmp/readme.txt .
        for l in $digits; do
mkdir $l
cd $l
cp /tmp/readme.txt .
cd ..
done
cd ..
done
cd ..
        done
cd ..
done

Read and post comments | Send to a friend