5 insanely great books about mathematics you should read.

I’ve been asked over and over for good books about mathematics for a layperson, someone who hasn’t taken advanced courses in university and is more simply interested in learning about what math is, and some of the more interesting historical figures and results from mathematics. Ironically, when you are a mathematics major at Waterloo, you get the opportunity in 4th year to take a course on the history of mathematics and you get introduced to a few really good books that start to explain the mindset and philosophy behind mathematics and not simply just the theorems and proofs.

Here are the 5 books about I most recommend to those who want to understand the mathematical mind and philosophy. Continue reading

The joys of cardinality – part 1

So, here’s an article I’ve been meaning to write for a while. I love Cantor’s diagonal proof of how there are as many rational numbers (of the form a/b, for example 1/5 or 1/2 or 3/5) and yet there are more real numbers (this is the numbers with an infinite expansion of decimals like pi, e, 3.5252353…) than integers.

However, everytime I try to share this with people I get stuck because it’s very abstract thinking, even though it’s really cool. So, this is my attempt to explain it in a few steps so that everyone can understand how thinking rigourously can teach you very cool things about numbers.

So, let’s start with the idea of cardinality. How can we clearly state that two sets of objects are the same size. I want a method that is indisputable. So let’s imagine we have 2 sets of objects, baskets and balls.

|_| |_| |_|   o o o

Now, above we can see, at a glance, that we have the same number of baskets as balls, but how can we prove it to someone who can’t count. Well, we can put one ball into each basket.
|o| |o| |o|

Yep, each basket is full, and each ball is in a basket. So we must have the same number of baskets as balls. This is great.

Now let’s try another set of baskets and balls.

|_| |_| |_| |_|    o o

Putting them into the baskets, we have

|o||o| |_| |_|

Hmmm… we have more baskets than balls. This means that the two sets aren’t the same size as we have empty baskets. Technically, mathematicians would say this is a injective mapping of balls into baskets. However, we’ll avoid the technical terms for now.

One more set, just so we have all cases covered for finite syts.

|_| |_| |_| o o o o o

Putting balls into baskets, gives us:

|o| |o| |o| o o

Now we have 2 lonely balls rolling around without any baskets. Again, this clearly demonstrates that the two sets aren’t the same size, as we have balls that need baskets, and all of the baskets are full. If we were allowed to put more than one ball into a basket, this would be a surjective mapping of balls onto baskets. Again, you can ignore these technical terms. As the key point here is we now have a clear way to determining when we have 2 sets whether they are equal in size, or whether one is larger than the other.

So let’s try with an infinite set of baskets, and an infinite set of balls.

|_| |_| |_| |_| ....

o o o o ....

Now, obviously, we need to find a clear way to represent which ball would go into each basket without having to draw an infinite number of baskets with balls in them to verify. So, let’s number each basket and number each ball in the obvious fashion.

|_| |_| |_| |_| ...
 1   2   3   4 ...

o o o o ...
1 2 3 4 ...

Now, there is an obvious way we can put every ball into every basket. We put Ball 1 into Basket 1, Ball 2 into Basket 2, and so on. Now, how do we test if every basket is full? Well, we check if the basket has a ball in it. So if you were to challenge me by asking (Does basket 34255 have a ball in it?) I can respond, yes, it has ball 34255 in it, by how we filled the baskets. This is true, because we know ball 34255 exists, and we agreed to this method of filling baskets.

Something interesting happens now, you throw a ball to me and tell me to put it into a basket. Well, all the baskets are full, so this should be, in theory, impossible, right?

I look at the baskets, and go ok. I mark your ball as ball 0 and put it into basket 1, moving ball 1 to basket 2, and so on…

|_| |o| |o| |o| ...
1/1 2/2 3/3 4/4 ... (Basket Number / Ball Number)

0 (Ball Number 0, which to make it clearer we'll 
represent as a ball with a slash on it)

So we do this, take ball 1 out of basket 1, and put into basket 2. ball 2 out of basket 2 and put into basket 3, and so on…

|_| |o| |o| |o| ...
 1  2/1 3/2 4/3 ... (Basket Number / Ball Number)

Put in ball 0 into basket 1

|Ø| |o| |o| |o| ...
1/0 2/1 3/2 4/3 ... (Basket Number / Ball NumbeR)

Now, every single ball is in a basket, even though we added one ball to the previous pile. This is one of the more interesting properties of infinity. Adding a finite number of elements to an infinite set does not change how many objects there are overall from this perspective. You could give me 100 balls, and I would only need to shift the first 100 down all the way down the line and there’ll still be enough baskets.

I’ll let everyone think about that one for a bit, and tomorrow I am going to go into how there are just as many even numbers as numbers in general. Hopefully ending with a framework to show how you can see there are just as many rational numbers (ie. fractions) as integers (whole numbers like 1, 2, 3).

Leading to the really weird realization in the following post that there are actually levels of infinity. 🙂

Please if anything here confused you, please ask questions. I’d love to have the chance to clear it up and develop an even better way to show this neat beauty in mathematics.


Enhanced by Zemanta

Nuit Blanche badge recap

So, the code will come. I promise that.

I had a fun 24 hours just before Nuit Blanche. I had this crazy idea of taking the SoonCon badge which we  (@saeruaisu, @jjstautt & me) built and programmed in 2011 and seeing if I could up the ante a bit on it. Find a couple of analog inputs, and have my iPhone send data to it in order to allow me to send tweets and other live data to the badge.

@jjstautt did a great job soldering the heads onto the end of a repurposed pair of headphones (sans headphones) and I bought a splitter so I could listen to the data as I sent it to the badge to make sure the computer was transmitting correctly.

Badge connected to laptop for testing with splitter and earphones to hear signal. (dit dit dit dit)

Now, the theory behind how I would send signals was to use the right ear as a clock pulse of sorts and the left ear as the data line. When the right ear had a signal, it meant that the arduino should listen to the left until the right ears signal goes down, if the left goes on for a set period of time (is up and not just noise), then the signal is a 1 and reflect that in whatever code that exists in the arduino software.

This alone was a bit of a pain in the butt. Took me a while to find a sound that the arduino would recognize reliably, as well as get it to not hear noise as the right or left ear turning on. My code is awful, but when I github it you’ll see the generla methodology I used for it. Having a variable I could fiddle to determine the best time to wait for the signal to be marked as on for both ears.

Once I had this in place, I simply made it so the clock pulse would iterate through the screen turning on or off the lights as per the signal. Since the fastest pulse I could reliable send to the arduino and have it receive it was around 0.15s, I could really only get about 8 bits per second to the arduino. When painting the screen, this lead to a refresh rate of approximately 15 seconds. Nowhere near fast enough to simply drive the badge with the iPhone.

Regardless, I trudged forward and programmed in xcode (I will also post this on github) a simple application that would let me draw “HI :)” and “< 3” on the phone as well as a few simple test patterns. Once I was confident that the data channel was solid and, in general, fault free. I went to sleep Friday night. Leaving a wonderful video for everyone showing I had the basic proof of concept working. Yes in this video that is xCode’s iPhone simulator running the badgeduino.

iPhone / Arduino sound modem project “Hello World!”

The next day I decided to continue on with this project, but to get it so I can send tweets effectively to the arduino badge, I would need to be able to send letters to it and not simply draw on the screen one bit at a time.

So, I added a special command where the left ear would send sole signals without the right ear at all to tell the arduino to go into “COMMAND_MODE”. This meant that the next 4 bits would be a command to do something or switch to some other mode of receiving. 1111 meant go back to the start, and 1000 went to what I refer fondly as “TEXT_MODE”. Now, there was intended to be the possibility of sending more commands, but I hit a pain in the butt hiccup which meant my code was too big for the badgeduino.

TEXT_MODE worked as follows. Each letter was 6 bits. This allowed me to have every letter of the alphabet and ! , . @ # . I forgot about the numbers, but by the time I hardcoded all the letters into the arduino code I ran out of usable space on the badgeduino and couldn’t have added them if I wanted.

When 111111 was received by the badge, that meant the message was complete, and that it should start scrolling it across the screen. I programmed a text box + button into the xcode and it worked wonderfully. I could type a long message and it would send it, slowly, to the arduino and it would scroll nicely across the screen.

However, it was at this point that I started seeing bugs appear since I was actually using more space on the arduino for the badge than there was space to store, so the code didn’t quite respond correctly and it would simply crash. I’m betting with some work I could optimize the code and get more onto that board, but at this point it was 6:30 and I still wanted to get tweets working in the xCode.

For the next 1 1/2 hours, I realized how pitiful the documentation was for the newest version of xCode around Tweets. I thought I had something working, but by the time I uploaded it to the phone, it would crash everytime I tried to get tweets.

So I came up with a plan so we could all get going. I would copy and paste any tweets sent to @kjrose so they would scroll across the screen. I got a few people asking me to put things that scrolled across, but it wasn’t as spiffy as having it run live.

I think I’m going to play with it some more for next year. Maybe turn it into a distance detector for @saeruaisu’s and @jjstautt’s phones pointing in the direction they are in from my iPhone making sure we don’t get lost now that I have the communication working.

Perhaps next year we can get some more of these badgeduinos (or build a better one that can handle a bluetooth adaptor so I don’t have to use my fancy, but somewhat noisy channel over the speakers) and get a larger crowd with these plugged into their phones.

Regardless. It was good fun, and I will get the code up hopefully this week. I just want to add some comments so it’s not all entirely badly written in a rush code. (remember I only had 24 hours from when I first got started on the idea to NB.)

Have fun everyone. Oh, and if anyone knows where to get the badge design for the SoonCon 2011 badge, let me know. I’ve very tempted to upgrade it for next year.


Enhanced by Zemanta