Thursday, April 30, 2009

Hamburger Train

I don't really feel like justifying this claim at all, but I'm going to say that I've been listening to Pork Soda lately, and I feel it is Primus's best album. So, grab yourself a can, I guess.

Sunday, April 26, 2009

Lately I've been rather listless. What happened to all my list?

I always get Orson Welles and George Orwell confused.

The old fashioned has always been that way, and always been delicious.

Tuesday, April 21, 2009

Broken Flowers?



It's starting to get hot out and all the cherry blossoms have fallen from the trees. I don't have anything poetic for you tonight, but enjoy these pictures of flowers in the river. They're building a bridge over it, but it won't be done until next year, so right now I have a torn up roadside and a temporary sidewalk to myself.

Friday, April 17, 2009

Mochi Maki Pictures

I mentioned that I didn't try for mochi because I was trying to take pictures/movies with my phone. Enjoy some of the pictures.

The house was at this point in construction and probably still is, so I'm not sure why they chose to do it the day they did. I really don't know much about the tradition, but whatever. Here you can see the kids messing around in front of the skeletal house waiting for their chances to win fabulous rice cake with maybe some money inside!


You can see the adults are also getting into the milling around.

It was quite the turnout, really.

This little dude took my phone and started taking a bunch of blurry pictures despite not being able to read the English, so the credit for at least some of these photos goes to him.


Some originals by the kid. He's a fourth grade student of mine.

This one shows some talent, I think. On to the main event...







Ha ha, pretty nice camera work, eh?

Mochi Maki

Yesterday I went to a mochimaki in my neighborhood. When people build a new house, it is tradition to have this thing where they throw mochi off the roof of the semi-completed house and neighborhood people, mostly kids, vie for it. Mochi, 餅, or 餠, if you prefer your characters old school, is this food that you make by taking a certain kind of rice and basically cooking it past the normal soft phase, using hot water, while you pound it. One would traditionally do that with a big wooden hammer and a special mochi holding thing, which I've gotten to do before, but now it is mass produced somehow and you can buy it in stores. What you get is a soft white substance, though it is often colored pink or green by adding other stuff like cherry or some kind of edible grass-type thing, which one might call rice cake, but cake is much lighter than this. There are a bunch of uses for it, including as an ingredient for special soups, and it's traditional to eat it at new years', but people eat it fairly regularly as a treat in various forms. Here is some that I've cooked (again, I didn't make it originally) with my toaster oven.


It puffs up like that and browns a bit when you cook it. The thing to do with mochi that you cook like this is add nori and shouyu, as such:


Nori is a kind of dry seaweed, the same kind that makizushi, literally rolled sushi, is wrapped in, though here it is just in strips because I have a bag of that for eating with rice. Shouyu is just soy sauce. You can totally taste the Japan in this and it is great. I only got this one little bag of mochi because I was not trying to catch any of it, but rather take videos of them throwing it off the roof with my cellphone, but this bag hit me in the foot, and some guy insisted I take it instead of giving it to a kindergartener. I also got some cream-filled bread which was pretty good because they just give out other kinds of food. Good times were had by all.

I just found out that the character 餅 is read bing3 in Chinese, and means biscuit. The 3 represents a tone for those wondering. Will wonders never cease?

Wednesday, April 15, 2009

It's Me, I Watch the Watchmen

I watched Watchmen the other night at a legitimate movie theater with a legitimate friend. I had originally decided rather half-heartedly not to see this movie because I absolutely loved the comic and knew that the movie could not be as good. For anyone who has not read/seen/heard of it by now, Watchmen is a graphic novel by Alan Moore that takes place on an earth slightly different from ours during the cold war, one in which costumed heroes actually exist. It's a brilliant piece of writing that works on a bunch of levels, and of course the art is good, too, but I don't really think that way, so I'm not going to bother with it.

Part of what makes it so good is that it is a story about what costumed heroes would actually be like, but it's better than that. A lot of fans only appreciate it on that level, but miss the point that it is really a comic that is about comics in that way, relates comic history indirectly (golden age, the end of superhero comics, silver age) via its own heroes, and actually contains a comic in and of itself that some characters in the story are reading as the main story progresses. Basically, it was intended as a graphic novel for a reason, and so making a movie out of it doesn't make any sense.

That said, it's pretty much the best movie that could have been made. The characters are all cast pretty much perfectly. I only have two gripes here, and they are pretty minor. The actor who plays Ozymandias doesn't look quite right, but I think that is mostly due to a costume redesign that, while not major, makes him look sort of like a little kid in a big kid's clothes. Ozymandias is one of two costumed heroes who actually have superpowers in the story, though his powers are just that he is a human at the peak of everything from intelligence to strength. The costume makes this hard to believe, so it is kind of annoying. Also, the actor's head is weird looking, which is kind of distracting, but he does an alright job, nonetheless. The other gripe is that the actor playing Rorschach does a bit of the Christian Bale-Batman Begins gravelly voice thing and it is over the top and annoying. It's not nearly as bad, though. Christian Bale actually ruins every scene he is in, in the Batman movies, but Rorschach's voice is only mildly irritating and much more natural sounding. Other than that, he does a great job, despite some flaws in the script.

My other problems with the movie are mostly nitpicky and stem from the fact that it is a movie. The story is cut down a little, though not to the point where it doesn't work, so it's not a big deal. I haven't read the book in a while, but I recall that Rorschach specifically talks about his philosophy of never compromising during the middle of the story, a philosophy that ultimately *spoiler* leads to his death. While his character is fairly well developed, if that had been left in, it would have been more poignant, I think. His background in the movie is mostly given in a couple of flashbacks, which are effective, but obviously the book does it better. This is just another example of why they should have left it alone. His story is cut down, necessarily, because of the format of a movie, and that does harm. I don't blame the director here, because he is doing exactly what he has to do to make the best product he can. It's that the idea he is starting with, adapting the book into a movie, is so flawed from the beginning that it can't be fixed. There is one other scene which is altered from the novel which involves Rorschach, as I recall, but it's not really a big deal. It's just annoying to me because I liked the book so much.

Overall, actually, you have to hand it to Zak Snyder for being so true to the book. At times, he almost copies shot-for-shot, and the movie works well because of this. There are other things that are cut down, but he does a good job of trying to give the fans something without bogging down the movie with details that would have stretched it out to five hours. I am mostly thinking of the golden age related stuff here. Again, it just goes to show that adapting the novel into a movie was a bad idea in the first place, because he is working within the limitations of the form.

That said, the ending is wrong, and there was no good reason to change that. The ending is functional, but the comic's ending is better, though similar, and I can't forgive the movie that point. Also, Dr. Manhattan's pivotal conversation with Laurie on Mars is altered in a stupid way that doesn't make any sense and actually detracts from the character. Other than that, Dr. Manhattan is great. He is played by a real actor but with the aid of CG, and it actually works out very well that he doesn't ever seem quite like he is there with the rest of the characters.

One thing should be mentioned, also, that is a huge problem, especially for me personally with the movie. The choice of music is almost entirely awful throughout. The opening montage is Bob Dylan's "The Times, They Are a-Changin,'" which made me cringe initially because I expected not to enjoy the movie and feared having a song so dear to my heart associated with it, but it actually makes sense. It's as if Dylan existed in the alternate timeline, too, and he still would have been singing about social change, etc. However, after that, it goes way downhill.

I don't know who was singing "Hallelujah" during the love scene, but it is possibly the worst rendition of that song imaginable, and honestly one of the worst versions of anything I have ever heard. I am completely baffled as to the reason for its selection. It's half-spoken, half-sung, entirely ugly, and almost rage-inducing. The only thing that overshadows it is the song over the ending credits, which I linked to in a previous post but had almost forgotten about by the time I went to see the movie. It is My Chemical Romance covering "Desolation Row" by Bob Dylan. I can't imagine why he would have given them permission to mutilate his song, but he must have. It is basically unlistenable and an affront to all that is good and holy. I don't just say that because I have a huge crush on Bob or a distaste for pop-punk in general. It's just very ineptly covered, altered to fit a genre for which it makes no sense, and played for a movie it makes even less sense for. I realize that a line is quoted for the title of the first chapter of the story; "At Midnight All the Agents." It's just that that is the FIRST chapter and has an obvious literal connection to that chapter, and has nothing to do with the ending of the story. On the plus side, Dylan's "All Along the Watchtower," as made famous by Jimi Hendrix, actually fits where it is placed and sounds as good as always.

If you haven't read the graphic novel, just read that. If you have, don't bother seeing the movie because it just can't possibly measure up. If you have only seen the movie, do yourself a favor and read the graphic novel, though it's partially already ruined for you becuase the ending is now obvious. Whatever your situation is, don't go see this movie, unless like me, you had a vested interest in seeing it with someone. It's not bad, but it's totally unnecessary.

Edit: I forgot to mention that I saw this at a mall movie theater, which didn't let out until about 12:25, which is after the stores in the mall are closed. Also, a lot of the doors are locked and escalators blocked off, which made even finding our way out kind of a challenge. Also, the parking lot was chained off, so I had to pull the posts out and unhook the chains just to get out. On the way out, I saw a security guard come over to the chains and check if they were back in the right spot or something. I think they didn't really think their closing all through, but there were only four people in the whole theater, so maybe they figured the cars were parked overnight.

Monday, April 13, 2009

Grad School

So I guess I'm going to Drexel. Alright.

Sunday, April 12, 2009

TV Fails Again

I just watched the pilot episode of Parks and Recreation, and I am going to declare it a failure already. It's clearly an Office imitation, but wrong in basically every respect. The primary problem I saw with it was casting Amy Poehler as the lead. She continues to be completely unfunny in everything she does. She tries way too hard to pull off a pseudo-Michael Scott character. She's not helped by the writers, who missed the mark on that character by shaving off a dimension. Michael Scott is an ingenious character in that while he does actually believe in a lot of the stupid things he's saying, he also obviously subconsciously knows that he's full of crap a lot of the time and is just trying to hide that from the cameras. Amy's character, Leslie, is completely one-dimensional and fails to amuse. She even falls down into a pit, eliciting not even a smile from me, only reinforcing the well established (thanks, Molly Shannon) rule that women are terrible at slapstick.

The worst part is not even that the show is terrible, as most shows are, and not even that it's been slightly hyped by the same people who mistakenly thought Poehler added anything to SNL. The worst part is probably that Aziz Ansari left Scrubs to join this show. Scrubs, while also not funny, at least gave him an opportunity for original stupid-funny in his short stint as Ed, the slacker newcomer to the hospital. Since his departure, nothing on that show has even made me chuckle, but while he was there, I was laughing. On Parks, he's almost entirely wasted. He has one chance to shine near the beginning of the pilot, hitting on Rashida Jones as she complains that her boyfriend fell into a pit, but the routine is so predictable that even his stupid genius delivery can't save it.

In short, boo, Parks and Recreation.

Saturday, April 11, 2009

Saunas and Equivalence Classes

Yesterday I went to a 岩盤浴 place called Peony with a Japanese friend I met a while back. A ganbanyoku is a sauna. You take a shower, put on a yukata-type outfit, and then go lie down on a hot rock floor for fifteen minutes. It's unbelievably hot in there, so the sweat just pours off you, but it's so humid that it doesn't evaporate, so you have to keep wiping the sweat off with a towel. Then you go rest in a normal room and drink water. Then you go back to the sauna, then rest again, and do this little cycle a few times or until your time runs up. Supposedly this detoxifies you, but I have my doubts. Anyway, it feels good. I'm sure I've retoxified my body by now, anyway, by eating Italian food. Let's talk about modular arithmetic.

The other day I was writing about equivalence relations and trying to get John to bring up modular arithmetic without mentioning it specifically, but instead he came up with a bebop equivalence relation for primes. If you recall, an equivalence relation is a relation on A X A that generalizes our idea of equivalence. One thing I didn't mention that is a direct result of equivalence relations is equivalence classes. You see, an equivalence relation on A (this is shorthand) partitions A into equivalence classes. A partition P of A is a family (just a set) of subsets of A such that:

1. If D and E are elements of P, then either D = E or D and E are disjoint (I can't make an intersect symbol because I don't know all the fancy code for that kind of thing, but disjoint means D and E share no common elements).

2. The union of all D's in P is A. Again, I can't make a proper union symbol, and here I doubt one exists because I would need a subscript.

That may seem kind of confusing, but it's actually intuitive. It just means that we are splitting A up into smaller sets, with each being separate from the other, like cutting up a pie or other delicious concoction that one might cut.

The nature of equivalence relations gives us a partition because if (a, b) in R and (b, c) not in R, then (a, c) not in R. That is, all the things that are equal will go into one and only one of these subsets in our partition. For a more concrete example, look at the non-negative integers [this is NU{0}, if you prefer]. We can partition this set using the standard equals relation. All the things will go into one and only one subset, for example 4 is a member of {4} only, 100 is a member of {100} only. In this case, each subset (an equivalence class) only has one member, but that's not necessarily true with every equivalence relation.

For example, I mentioned that similarity is an equivalence relation on the set of triangles, and walked through a proof of that. An equilateral triangle with side length 1 is "equal" under this relation to an equilateral triangle with side length 2, or with side length 3 or pi or a bazillion. All of these triangles thus fall into the equilateral equivalence class. A 3-4-5 right triangle, however, falls into a different equivalent class, the same class occupied by a 6-8-10 right triangle, as well as any other 3x-4x-5x right triangle. Every triangle falls into exactly one equivalence class, though every equivalence class contains an infinity of triangles. For those curious, each equivalence class is uncountable, and the partition itself is also uncountable. Can you picture a pie cut into an uncountable number of pieces?

So, what does modular mean, and what does arithmetic have to do with anything? Let's define an equivalence relation on the set of integers. First, we will choose arbitrarily an integer that we like. For me, such an integer is 3. If we take any integer (this includes negative integers, but you might want to consider non-negative ones first for simplicity's sake) and divide by 3, we are left with a remainder. Then let's say two integers a and b are equivalent [ (a,b) in R] if and only if the remainder they leave when divided by 3 is equal. So, 0 = 3 = 6 =...; 1 = 4 = 7 =...; 2 = 5 = 8 =...

Like a good mathematics student, we should assure ourselves and our readers that we have not in fact pulled a fast one, but that we have a bona fide equivalence relation.

1. Obviously a leaves the same remainder as a, so reflexivity on A (in this case Z) holds.

2. If a leaves the same remainder as b, obviously b leaves the same remainder as a, so symmetry is a go.

3. If a and b leave the same remainder, and b and c leave the same remainder, then a and c clearly leave the same remainder, so transitivity is also confirmed.

Following our previous reasoning, since we have an equivalence relation, we should have naturally defined equivalence classes. What are they? I've already mentioned them up above, though not explicitly. They are [0] = (0, 3, 6, ...); [1] = (1, 4, 7, ...); and [2] = (2, 5, 8, ...). It is worth noting that [0], [1], and [2] are themselves sets, so we can think of P = ([0], [1], [2]) as a space of sets on its own, and will want to.

On to the arithmetic, the queen of mathematics. Let's define arithmetical operations on this set, which I shall call Z3 for obvious reasons, in the most natural way. We'll define addition of two of these elements (the equivalence classes from above) thusly

[a] + [b] = [c + d] where c is any element of [a] and d is any element of [b]. Again, have I pulled a fast one on you? That is, is this operation well defined [can I really choose any two elements and get the same result]?

The answers are no and yes, respectively, and here's proof.

If c in [a], then c = 3n + a. Similarly, d = 3m + b. The numbers n and m stand for some integer.

Then c + d = 3(n + m) + a + b. Then [c + d] = [a + b].

We can define subtraction and multiplication the same way, it turns out, but I am not going to work that out for you.

To concretize again, what does that mean here? If I could make you a pretty chart, I would but, forgoing the bracket notation, as is standard in this case, we have

0 + 0 = 0; 0 + 1 = 1; 0 + 2 = 2

1 + 0 = 1; 1 + 1 = 2; 1 + 2 = 0 [[3] = [0], since we are concerned with the equivalence class]

2 + 0 = 2; 2 + 1 = 0; 2 + 2 =1

Some things to notice here:

0 + a = a + 0 = a. In other words, 0 is the identity element of this operation.

a + b = b + a. In other words, + is a commutative operation.

For every a in Z3, there exists an inverse of a in Z3. That is, there is c such that a + c = 0, the identity element. For a = 0, c = 0; a = 1, c = 2; a = 2, c = 1. Subtraction can be defined as the addition of the inverse, which is exactly equivalent to the intuitive way of defining subtraction.

One can also work out that + is associative, but that's rather tedious to type out. What we have here is what is called a group, but I'm not going to get into all that.

As I mentioned before, we can define multiplication intuitively, as well. So, we have

X 0 1 2
0 0 0 0
1 0 1 2
2 0 2 1

Again, we find that multiplication is commutative and associative, which should come as no surprise, since our intuitive definition here is derived from normal operations, which are themselves commutative and associative. We also notice that 0(a) = 0, regardless of a.

Under multiplication, so defined, 1 acts as the identity. That is 1(a) = a.

Another thing we might notice in Z3 is that if a is not 0, a has an inverse. We might also notice that if a and b are both non-zero, then ab is also non-zero.

That's all fine and dandy, but as you might suppose, we can generalize to positive integer here instead of 3. That is, we can create a space Zn for any positive (actually non-zero will do) integer n. The next easiest example, and one that suits my purposes, is Z4.

Addition, Z4 style

+ 0 1 2 3
0 0 1 2 3
1 1 2 3 0
2 2 3 0 1
3 3 0 1 2

Multiplication

x 0 1 2 3
0 0 0 0 0
1 0 1 2 3
2 0 2 0 2
3 0 3 2 1

Addition is all fine and dandy, and again we have a group, but take a closer look at the 2 row (or column) of the multiplication table. See anything weird?

Firstly, 2(2) = 4 = 0. That's a little odd from our usual experience with multiplication, since 2 isn't 0.

Secondly, there's no inverse for 2. That is, 1 still acts as the identity, but there's no way to get a c in Z4 such that 2c = 1. Weird, right? What this means is that for some reason Z3 is pretty while Z4 is not. In more precise terms, there are certain types of equations that are solvable in one while they are not necessarily solvable in others. So my question to you is what is the difference here? I know the answer and I'm pretty sure John does, too, but think about it.

Thursday, April 9, 2009

A Taste of Beer

Suntory The Sraight clocks in at 6% alcohol, a bit stronger than usual, but just behind Kirin's Strong Seven. The can claims "This 'koku & kire' taste cheers your mind." It doesn't really, but it's not bad.

Now to the テーマ of this little venture, flower viewing. Once a year, the cherry tree, a national symbol of Japan, comes into bloom and people flock to see it, but mostly I think they come to have picnics and be social. Luckily, I'm only a half hour from one of the top 100 sites in Japan for this, so I have some pictures that maybe you will like.


On the banks of the mighty Hii river, we find this gate telling us that there are cherry trees.

Here's the river itself, or maybe the Mitoya river. I took these pictures a while ago so I don't remember exactly what I was pointing my phone at.


I'm pretty sure this is the Mitoya river. They meet up, anyway. In the lower left hand corner, you can see me, or at least my thumb.


All down the right side you can see cherry trees in bloom.

And now the left side.

I ran into some people I knew and some people I didn't know, but being a foreigner in Japan gives you the opportunity to know tons of people you didn't know. Here's Chie-chan, who I met that day through some mutual friends.

One night of hanami ended with some live jazz. You can kind of make out a piano player, a guitar player, a drummer, and a bassist. They played a bunch of stuff, including "Take the A-Train," which is one of my favorites. And even better, then the fireworks started. It was kind of cold that night, but I got some hot chocolate from a vendor there who insisted on speaking to me in English.



The jazz was a lot better in person than captured by my cell phone.



Alas, the cherry blossoms have no doubt all fallen off the trees by now, but the temporary nature of them is what really makes them wonderful. 電光朝露

I had a six year old girl tell me she wanted to marry me the other day, and a bunch of girls who were probably seven or eight at most asked me if boys can marry boys and girls marry girls in America. I told them that they can in places (way to go Iowa and Vermont, by the way!), to which they responded with ii na-! which basically translates to "I'm jealous." Little kids are so weird.

Today I was at the entrance ceremony for the new first graders at one of my schools, and one of the kids kept making weird motions and stuff during the speeches and making weird "gah" type sounds while the kids were playing fruitsbasket. Everyone kept laughing because he was pretty hilarious, but I think it goes to show how weird it is to make kids that young sit through ceremonies that are usually over and hour long. Anyway, fun for me. It's back to real work starting Monday.

Wednesday, April 8, 2009

A Taste of Bob

Hey, check out this sneak listen of Bob's new album from Newsweek. I hope you like accordion.

Tuesday, April 7, 2009

Happy Birthday, Buddha

Apparently it is Hanamatsuri, the non-state holiday in Japan celebrating the Buddha's birth. So, omedetou gozaimasu, I guess. Let's talk about equivalence relations.

As always, what am I talking about? First, we must relate what a relation is, but in order to do that, let's talk (you listen) about Cartesian products. Let's say we have two sets, A and B. The Cartesian product A X B is the set of pairs (a, b) such that a belongs to A and b belongs to B. That's pretty easy, right? Just think of the aptly named Cartesian plane for an example, but keep in mind that our objects need not be numbers at all, but could be themselves pairs or sets or anything we choose (within the normal boundaries of set theory here).

On to relations! A relation is nothing more than a subset of a Cartesian product. Let's name our relation R, as is standard. Then a is said to be R-related to b if (a, b) is an element of R. That's pretty alright. It's worth noting that functions are relations, albeit relations with a special property.

Now let's consider the special case of A X A. That is, both the sets that we are Cartesian-producting are the same set. A convenient example would again be the standard Cartesian plane, but don't let your thinking get all boxed in to these number things. An equivalence relation R is a relation on (i.e., a subset of) such a Cartesian product, with three properties.

1. For all a in A, aRa. That means (a, a) is always a member of R. Another way of saying this is R is reflexive on A.

2. If aRb, then bRa; that is (a, b) in R implies (b, a) in R. In other words, R is said to be symmetric.

3. If aRb and bRc, then aRc; (a, b) in R and (b, c) in R implies (a, c) in R. R is said to be transitive.

This may all seem very abstract, so let's look at an example. In this case, A will be the set of triangles and R is the similarity relation. That is, triangles a and b are R-related if and only if their angles are congruent. You should recall that from geometry, but I find people tend to forget that kind of thing.

Is R an equivalence relation? We shall check the three conditions.

1. If we choose any triangle, is it similar to itself? I should hope this would be obvious.

2. If a is similar to b, is b similar to a? If the angles line up, then they obviously line up, regardless of which triangle we are looking at first.

3. If a is similar to b, and b similar to c, is a similar to c? The transitivity of the angles' congruency makes this fairly obvious, no?

So it's not that hard a concept to grasp. You could also look at congruency of triangles on this set and find you have another equivalence relation. Congruency would mean that the sides, in addition to the angles, would need to be of equal length for two triangles to be related.

So, why does this mean anything? Well, consider the case of equality in the usual sense. If you check, you will find that it meets those three conditions. What we have done here is generalize the idea of equality. In fact, if you look at the triangle example(s) again, you will find that we have found more than one way of defining equality on the set of triangles. That's pretty neat, right? Open problem for anyone (even though John no doubt has an answer ready already from number theory): can you come up with another (hopefully non-trivial) equivalence relation on the set of integers?

I tricked you into reading this post by giving it a non-math title.

Monday, April 6, 2009

P vs, C

Since that last post probably went over some heads (only John probably read the whole thing), I've decided to clarify my thinking on permutations and combinations. Apparently, my computer does not recognize the plural form of combination. Anyway, let's start with a permutation.

A permutation is just an ordering, really. Let's say we have two colors, red and blue. How can we order those? Well, (red, blue) is fine, and so is (blue, red), so we know that there are two permutations for two things. One way of expressing that would be P(2) = 2. What if we have five colors? We could list these out again, but common sense tells us that it's going to be quite a few things, and thus a formula would be much nicer. So, how do we get there?

Consider the first element of the order (permutation). There are five possibilities. For the next element, since we've already used one color, there are only four possibilities. So there are 5 x 4 = 20 ways of choosing the first two elements. Following this logic, there are three possibilities for the third element, two for the fourth, and one for the fifth, so we have

P(5) = 5 x 4 x 3 x 2 x 1 = 5! =120.

The exclamation point means factorial, and the definition of that should be obvious from that equation. Pistol Pete liked to just say things like "Five!" with the emphasis, as if it were an exclamation. Generalizing, we have

P(n) = n!

The next step is to think about not choosing all of the colors. That is, what if we wanted to know how many ways we could order two of the colors out of the five. The solution is actually pretty obvious, and we've done it before. You could think of it like this: for the first element, there are five choices, and for the second element there are four, so we have P(5, 2) = 5 x 4 = 20. What we want here is just the last n-r integers multiplied together. Here's another way of thinking of that. For every way of ordering the first two colors, there are 3 x 2 x 1 ways of choosing the last three, and ordering the first two and ordering the last three is the same as ordering all five. That is,

P(5, 2) x P(3) = P(5). Since we have a formula for P(n), we use algebra to get

P(5, 2) - P(5)/P(3); generalized,

P(n, r) = P(n)/P(n-r) = n!/(n-r)!

Now a note on notation. I am using P(n) to mean permutations of n things and P(n, r) to mean permutations of n things, r at a time. This is function notation, which makes sense because permutations are indeed functions (think about it if you aren't convinced), but permutations are often written in the form nPr. This is funny to fans of national public radio.

On to combinations. A combination is, in a way, simpler than a permutation. To continue with our color example, a combination of five colors two at a time would mean taking any two of the five colors (I did not specify colors here so that you can choose the ones you like), and not worry about the order. That is, if I choose my favorites, (green, yellow), and you choose (yellow, green), we have chosen the same combination and will only count that once. However, if you choose (green, blue), then we have chosen differently and will count that twice.

The easiest way (to my mind) of getting a formula for combinations is by looking at the formula for permutations. Again continuing our example, we had P(5, 2) = 5 x 4 = 2o ways of ordering two of the five colors at a time. But here, we don't care how they are ordered, only what colors we have chosen. So, the reasonable thing to do is divide by the number of ways of ordering the ones we have chosen. Fortunately, we already know how to do that. It should be 2! = 2 x 1 =2.
To generalize, we have

C(n, r) = P(n, r)/P(r) = n!/r!(n-r)!;

both those last two factors are in the denominator, if that wasn't clear. Again, I am using function notation, but nCr is also common, as well as just putting n over r (not division, there is no line) in parantheses following C. That is generally read "n choose r." And that's all there really is to it.

Sunday, April 5, 2009

Combinatorics

No one seems to enjoy me talking about stuff that I ate, so instead I shall endeavor to talk about something much more interesting: math. In a recent post, or more specifically, the comments on a recent post, the topic of combinatorics came up, and since that is an area of math that most people aren't probably familiar with, I think it stands to reason that it might be of interest.

So what is combinatorics? It is counting. That seems pretty easy, right? Well, no, it isn't, but it's kind of a fun area of math in that it is like little puzzles that require you to think outside the boxes (this is a pun that will be made clear by a later example). Combinatorics problems are often involve figuring out the number of ways one can group things together or order them or some such thing, and they often seem easy at first, difficult in the middle, and then not so bad at all in the end. I only had one class that dealt with the field specifically, but it often comes up as part of more complex problems in other areas.

Let's take a look at a problem I was thinking about while making the ten kilometer walk back to town today after some scheduling issues.

Let's say we have n balls that are all identical and we have m boxes in which to put the balls. How many ways can we do that? This problem should illustrate combinatorical thinking pretty well.

We could say that for each ball, there are m possible boxes, so we would have m^n ways, which makes sense in light of the first rule of counting, which is that instances that don't affect each other (this is my way of thinking but hand-waving as a professor of mine would say), that is things counted by and, mean multiplication. What I mean here is that we could put the first ball into any of m boxes, and then the second into any of those, so we would have m x m ways of putting two balls into m boxes; extending to n balls would yield m^n. However, if you are clever, you will have noticed a little issue here. That is, overcounting.

Overcounting is one of the problems we always have to watch out for in combinatorics. Here, all the balls are identical, so it doesn't make any sense to think of each ball individually like that. What we are concerned with is how many balls are in each box, which we have overcounted here in that multiple outcomes from our previous approach will be counted separately even though they are identical. Drat.

So, what do we do? This is the stage where the problem seems to be much harder than we anticipated. I have an at least partial solution, but if you want to work it out for yourself, enjoy this picture of some flowers (if the computer starts cooperating).



How about to count this, we count something else? This is the kind of outside the box (it is clear now?) thinking that we often need. So, let's draw a picture, in the abstract sense that mathematicians like. Seriously, draw a picture of n balls all in a line. If we put a vertical line on each end of our line of balls, we can picture boxes here as represented by two lines (each line represents a side of the box, as it were). With just these two lines, we have represented only the left side of the first box and the right side of the last box. If we only have one box, we are already done, but it's not really necessary to draw a picture to figure out how to put balls into one box, is it? Each additional line we add between balls represents simultaneously the right side of the i-th box and the left side of the (i+1)-th box. So now we are just counting how many ways we can put lines in between dots, which seems much more manageable, but is really the same problem. This is the part where the problem seems not so bad again.


Here, however, I propose we make a little caveat to simplify our math. Let us say that while the balls are identical, the boxes are not, so that we are not concerned with instances where we are putting the same number of balls into two boxes and calling them separate instances. That is, we are saying that they are indeed separate instances and we can tell the differences, so we are not overcounting again. One more caveat is that we don't want any empty boxes. Actually, this isn't such a big deal, but it is simpler this way and if we want, we can extend the problem to include empty boxes without much hassle, but simple cases -> complex cases is the general mathematical trend, so I propose we follow it.


Back to the problem at hand, then. How many ways can we place the lines here? First, how many lines do we have? Since each box will have precisely one right side (and one left side), and the last right side is already accounted for, we should have m-1 sides to worry about. And how many places are there to put it? If we number each space, we should see that there is a space to the right (or left) of each ball, except, again, the last, which we already accounted for, so there should be n-1 places. Then it is a simple matter of choosing among m-1 things, n-1 things at a time, or C((m-1), (n-1)) for those people who remember those combination things from algebra II. That is, (m-1)!/(n-1)!(m-n-2)!, if I recall and am applying my algebra correctly. It's important to note that we are using combinations as opposed to permutations, because we are concerned only with where we place the lines, not the order in which we place them. For anyone that wants a discussion of P versus C, I might get to that with another post. If all this is going over your head, don't worry too much about it. It's actually pretty easy, but there might be some notation things going on.


Now, regarding extensions...I proposed leaving no boxes empty because doing so would mean counting instances where two lines are placed in the same spot, which isn't as immediately obvious as a straight-up combination is, but is manageable, and you can probably figure out a way around it. I'm not going to push myself too hard as I am tired today from walking 20 kilometers in the sun. The other caveat deals with a particularly annoying aspect of overcounting, where our current system of lines and dots may turn out not to be sufficient for telling when boxes need to contain different numbers of balls to be considered different. This is the joy of mathematics, though; there is always more to do. Somebody said it was really the only infinite field of study, and that is right, I think. Eventually, theoretically, we could know all the physical laws of the universe, all the things that have happened and how and why, even, but there is always a new math problem sitting on the edge of what we just figured out. It is a beautiful frustration.

Mundane Details

If you are bored reading about me doing nothing at work, I hope you enjoy this post of the pictures of my food variety


I made some pancakes with this chocolate banana milk a while back. Typing that makes me think I already posted about that, but it's pretty gosh darn exciting, so pancakes. If you look carefully, you can see the box that the hotplate came in. I ate these pancakes while watching Flight of the Conchords, which is pretty funny and surprisingly understandable for starring a couple New Zealanders. I work with a New Zealander and I honestly can't understand at least half of what she says.


Mmm I love the aroma of green. This beer was pretty decent and seems to be sticking around for the long haul, which makes me happy. It's always sad when some limited time item disappears, but happy when something new comes around, like fried chicken- or "cheese festival"-flavored pringles. If an actual cheese festival tasted like those chips, nobody would like cheese festivals. They'd just wander around the festival grounds licking things trying to ascertain the cheese flavor when really there isn't any and they just taste like chips. Or something


This fish was labeled "seigo" which is not listed in any of my dictionaries. I have a suspicion that the guy who runs the fish store is using the local dialect in labeling the fish. He's a pretty cool dude who works like 20 hours a day. He's my friend's father-in-law and apparently called me moja-kun because he couldn't remember my name and my beard was very moja moja. I can't translate that term; it's just how beards feel, or rather the sound of how beards feel. Japanese is full of words like that. Incidentally, I'm told the hair on my arms is fuwa fuwa. Kids like touching my beard, but I just shaved it off the other night.

When I bought that fish, actually three of them, the cashier asked me out of the blue what I was going to do with it because she had no idea what you do with this fish. I told her I didn't know either and would investigate, which she thought was funny. This is the only time I've seen this fish for sale. I noticed later that the package said it could be used to make sashimi, which means straight up raw fish. Some of the fish is labeled that way, but I never make it into sashimi, and I wasn't going to with this because I didn't notice that until the next day and by then it is too late to eat it raw.



This little dude up here is a konoshiro, which apparently means gizzard shad. Quite the name, eh? Again I hadn't seen the fish before and didn't know what to do with it, but the package said that it made good shioyaki, so I did that. Sort of. That means that you put a ton of salt on it and broil it. I didn't put that much salt on it because why bother. When I say a lot, I mean that the salt is absolutely caked on the fish, like a thick skin, and you just knock a lot of the salt off before eating it.

I have some pictures of flower viewing, but I'll have to get them off my phone and I don't feel like bothering with it right now. Also I'm kind of tired and John Coltrane is helping me on my way to sleep.

Thursday, April 2, 2009

Science!

My theory about who was bringing me tea in the morning has received more evidence. Today, there was no tea on my desk and the prime suspect is not here. I am too busy fiddling with Catalan numbers to worry much about it.

Wednesday, April 1, 2009

Snack Food and then later some stuff about Bruce Springsteen

One of the best things about work in Japan is someone is always giving you food. It's weird. Each morning somebody leaves a cup of tea for me to drink on my desk. I'm pretty sure I know who it is, but not entirely. She usually comes around once or twice a day and gives everyone in the office some kind of elaborate Japanese snack. When I'm at schools, someone will always give me coffee or tea, generally without asking if I want anything or not. When they do ask, I generally politely refuse, but that's usually met with them just giving me the stuff anyway. Also, there is usually candy or something like that, and if I stay till around 5:00 (I can go home at 4:15 according to my contract, and usually even earlier if I so chose because the schools realize I am not doing anything and don't mind), everyone takes a break, which means someone will again bring me unprompted coffee, and other teachers will try to coerce me into eating whatever snacks they have for this break time. I'm not hard to coerce or anything, but I try to be polite.

I keep seeing things about Bruce Springsteen online, not even advertisements, but news stories, and it seems to me like once you get famous enough, you don't have to work at it any more because everything you do becomes news and therefore promoted for you. I don't mind seeing all this stuff about the Boss; I think he's alright, and it makes for a good break from reading important news. I don't like his stupid little soulpatch, though, or his tendency to wear vests.