Tuesday, February 24, 2009

Enjoyment Can Regress

Mosch and I used to go on a lot of hikes, bicycle rides, etc., and over time I noticed a very strong pattern: experiences that were difficult in the moment often magically transformed into enjoyable after they were done. I could be miserable, sweaty, and working way too hard, and later on say, "Man, that hike was awesome!"

Once I realized this, the point of enjoyment moved backwards in time. I would start thinking the hike was great immediately after we got done. And then eventually I started really enjoying the hike while still hiking. I don't know for sure, but I think there was a causal relationship - the knowledge that I would later feel that I had enjoyed the outing led me to enjoy it in the moment.

I'm finding the same thing with math these days. I keep saying that Ed and I talk about math a lot and implying that it's fun, but in the moment, it's often actually difficult and frustrating. He raises a lot of questions that I don't want to go into because, damn it, I want to get where I'm trying to go, not take a lot of painful side trips. I don't want to work "uphill" all the time. I want to only talk about the parts I understand. I certainly don't want to learn anything new.

But later, I invariably retrospectively enjoy the conversations. It's not just that I enjoy having had them; I actually feel as though, in retrospect, I enjoyed them at the time. The memories are pleasurable. And I now feel that enjoyment regressing, happening earlier and earlier. Sometimes I am even aware of enjoying the math conversations in the moment.

Does this happen to other people?

Monday, February 23, 2009

Oral Exam

I had my oral exam in geometry today. I spent almost the entire weekend (with some breaks for meals, roleplaying, and Diablo) preparing myself for it. The prof had given us a list of examples, theorems, definitions, and problems from the book that he might ask us about during the exam, and I wrote up and/or reviewed all of them for myself. Today at lunch, I went over a couple of the more complicated ones again, just to be sure I could do them. (There was one I still never could do properly, but the rest I was fine on.)

I had envisioned that he might ask me a couple of questions. I was worried that he might ask me the one I couldn't quite get. The grading scheme for these oral exams (and for presentations in this class) is good/fair/poor (95/75/35), with a possible 100 if you are magically perfect, or a 0 if you totally don't do it. I knew I would get at least the 75, but I would have been very disappointed; I wanted the 95 and thought that was realistic.

Instead of a couple of questions, he had me do problems (at a chalkboard) for the full half hour, and actually a little bit beyond. He gave me my choice of the first problem, and I chose a nice hard one that I did understand, and when he asked me if there was another one I liked, I said that there was only one I could not do, and so we discussed it a bit. (It was one of the homework problems, and he said that my proof was actually better than his except that I did have that one minor thing I wasn't able to do. So that was cool. He had copied my proof - with corrections - on the answer key after his own, saying, "Here is a better way to prove this, courtesy of one of your fellow students." This is the homework that I got the C on.)

He didn't make me do the one I couldn't do - we just talked about it - but we did a ton of other ones. I was able to handle all of them. He said, at one point, "These problems are too easy for you," and, for the first time in my life, I wanted to assure him that I had actually worked quite hard to develop the mastery I was displaying and was not finding the class to be a cakewalk at all.

In the end, he gave me the 100, which wasn't even on my radar of possible scores. I left feeling like a Brilliant Math Genius. He also asked me if I was planning to go to grad school in math, and said that I should.

Afterwards, we talked a bit about the course, and I told him that the homework that I got the C on was extremely long, conceptually. He said he is just starting to figure out where everyone is. And apparently my 14 out of 18 points was the highest grade on that assignment. So...yeah. He might need to adjust his thinking a bit.

Sunday, February 22, 2009

A Bad Grade

Last week, in my Geometry course, we had a homework assignment consisting of 5 problems, 4 of which were proofs. I spent many, many hours on it. I probably spent at least 10 hours writing the proofs up, plus numerous other hours thinking about them, discussing them with Ed, working on them in my head, scribbling notes on pieces of paper, drawing diagrams, and so on. There were mornings when I woke up with a clear sense of having worked on a proof all night in my head. (And indeed, in one case I was able to wake up and quickly resolve my remaining issues and then write the proof. All before the alarm went off.)

I got 78% credit on the assignment.

I'll grant you that the class median was 64%, and the average grade was even lower. Most of the class did worse than I did, which comports with my experience of generally being an above average student in my classes.

But I worked fantastically hard on that assignment. What I turned in was six very neat pages of proofs, handwritten, with diagrams. All but one of the proofs was, as best I can determine (I haven't gotten the homework back yet, just seen the grade online), correct, and the incorrect proof had only a trivial section that I wasn't able to complete. The professor's solutions take up 3 pages of single-spaced type, so it was a long assignment, and not just for me.

It's not that I think I should get high grades just because I worked hard. (I certainly don't want other people who work hard to get the same grades as me if I outperform them. That may be uncharitable but I also think it's not good for grades to work that way.) But it's disheartening to have spent so very many hours producing so very much good work and get a C.

What I have to remind myself of is that this class is an elective. I signed up for it because I thought it would be fun, interesting, a challenge, and good on my transcript (assuming, you know, I don't get a C in the class, which I most likely won't). And right up until I got that stupid grade, I was enjoying the whole thing immensely. I had a wonderful time doing that homework. I was fantastically engaged. I talk about this stuff with Ed all the time for pure fun, and my understanding of it is pretty strong (relative to what I think is reasonable for being at this point in the course). The geometry is beautiful, clean, and thrilling.

I need to use the grade(s) only as motivation to keep stretching because I love the stretching itself. I can't let myself be demotivated by some sense of futility when I'm only doing this for the joy of it anyway.

Tuesday, February 17, 2009

The Whiteboard

A couple of weeks ago, Ed bought a whiteboard for our apartment ($8 at Walmart). He already had a tripod-style easel that his mom gave him, so this easel-mounted whiteboard now lives in his room. The idea was to make it easier for us to show each other things, and also as a general math-working space for him (I think).

Last night, quite late, he was eating dinner and I wanted to show him the smallest finite projective plane (the Fano Plane). It's really hard to show someone something on paper, because you just can't write on paper while holding it such that the other person can see it, at least not easily. This is doubly true if the person is trying to eat a plate of pasta at the same time.

"Want to use the whiteboard?" he asked.

It was our first time to try it together. He got to chill out sitting on his bed with the pasta while I drew and explained the plane (shown at left). And it was awesome.

I wasn't that into having a whiteboard, but now I can't see how we could live without it.

Friday, February 13, 2009

Clever Programming

There are certain programming language features that my Principles of Programming Languages professor disapproves of. For instance, in C (and, to a slightly lesser extent, Java), the operator == is used to compare two things. For instance,

if (a == b) {
(do something)

will do the something if a is equal to b, and not otherwise. On the other hand, the operator = sets one value to be equal to another. For instance, a = b will take the value in b and store it in a.

However, the = operator also returns the value of b, so if you want to be clever, you can do something like

if (a = b) {
(do something)

This sets a equal to b and does something if b was true. Unfortunately, it also leads to rampant errors, because when people type if (a = b) they almost always meant if (a == b), and if = did not return a value, then the compiler would let you know you were making a mistake.

So, my professor is against using = in an if statement; it's the kind of clever thing that leads to mistakes. He also inveighs against things like using the ++ operator in an expression. If you write a++ it will increment a by 1 (so it is the same as a = a + 1). No problem there. ++a does the same thing. But where they are different is that they each return a value, but ++a increments a before returning it, and a++ increments it after returning. So that if I said something like

if (k++ == 3)

I would be saying "If k is equal to three (and, by the way, after you do that, increment k by 1)..", but if I wrote

if (++k == 3)

I would be saying "Increment k, then if it's equal to 3..."

Clever! It saves you a whole line of code, and makes your code harder to maintain and more error-prone at all once!

A guy in my class (who looks like a young, evil Vincent D'Onofrio) argued back, saying that he always uses such methods when possible. He argued that anyone who knows the language should be able to read a statement like

if (a = ++k)

so that he is not worried that it won't be understood. He doesn't work with CS1 students, after all. Someone who wouldn't understand these basic language features is worthy only of contempt, he suggested.

What I think he's missing is that maintenance makes up most of the costs associated with code, and every time that it takes someone 10% longer to read a line of your code, or even 5% more likely to make an error in maintaining it (not to mention your own increased chances of error in writing it), it un-pays for itself. And what was the benefit to begin with? Occasionally getting to skip some typing? Feeling clever by combining statements?

I think it's foolish.

Wednesday, February 11, 2009

Death and the Continuity of Memory

I could write a lot of things about death, but suffice it to say I'm against it. I'm also curious what my own beliefs suggest about what I think constitutes death.

I read a science fiction book a few years ago that I really enjoyed, but unfortunately can't at this moment remember the name or author of. But in this book, you could own a machine that would make clones of yourself, of varying quality (the good ones were very expensive, the menial ones less so). These clones had self-awareness, but they would die (melt down or whatever) at the end of the day. However, you could upload their memories to yourself before they died. (Some people never did, but others, like the book's hero, almost always did.) The book had some kind of a plot involving investigations, and it was told from the perspective of whichever clone (or original) of the protagonist was involved in the action at a given time.

So, you (a clone) would wake up in the morning, and think, "Ah, today I'm the clone." Because you'd have the memories of the person you were cloned from, and that person would have the memories of being a clone as well as a regular person. I think one of the clones once observed, "Some days you're the clone, some days you're the original," which is surely what such a situation would feel like. Some clones were fearful of their deaths, but especially fearful of dying without uploading their memories. To live for nothing!

Sally and I used to talk a lot in college about things like whether using a teleporter (something that destroys your body and builds an identical one in a new location) was the same as death. If I die but an identical person wakes up with the exact same thoughts and memories, what happened?

What about my surgery? When Tam was laid on the table and totally lost consciousness, did she die? And did the body I call my own then wake up later, with me in it?

What about sleep? Will I die tonight, and will someone 'else' wake up with my exact memories?

All of this seems to assume some kind of mind-body dualism, which I don't believe in, but which I also find impossible to get around in my own head.

But what seems clear is that continuity of memory is the key to not feeling as though you've died (or that someone else has died and been replaced by you, I guess I should say). When that clone wakes up in the morning, he remembers being a clone before, many times, and that makes him feel like he won't die either. I'm not afraid of dying from falling asleep, because I remember falling asleep many times and I'm still here. And if I went through a teleporter a few times, I'd lose my fear of dying from it, because I would remember having done it and come out the other side.

Is that enough?

Tuesday, February 10, 2009

Math Is About Definitions

My college (Metro) has a course that is designed to transition you into higher (proof-based) math. It is called "Introduction to Proofs." At the Colorado School of Mines, the equivalent course is Discrete Math (which is also taught at Metro - I took it, as you might recall - but doesn't have the same gateway function). A lot of other schools seem to have a similar course.

I expected Proofs to be pretty easy, because I did very well when I took Logic at Rice, and I've always been good at doing logic and proofsy things. But actually, the course was pretty challenging although I did do well at it.

But there was one main thing that I learned, and I find that I keep learning this thing over and over again: math is about definitions. When you need to do a proof in math, the main thing you need to focus on (at least in my experience) is the relevant definitions.

Case in point. I was thinking the other day about how to prove the distributive property of multiplication over addition, that is

a * ( b + c) = (a * b) + (a * c)

It's pretty easy to prove in the natural numbers (i.e., positive integers). a * b is b added to itself a times, and you can get to it pretty easily that way. But when I got to thinking about the real numbers, I couldn't imagine how you could go about proving it.

I was talking to Ed about it, and he wasn't sure either, and at some point I realized, of course I can't prove this: I don't know how to define multiplication in the reals at all! How could I have an inkling of a proof if I don't even have a definition of multiplication? (There is no way to get at "pi times the square root of 2" through repeated addition, at least not that I can see.)

And that's how it always is. If someone asks me to write a proof, the main technique I have is to look at the definitions involved and then work from there. If I'm missing a definition, then I have to solve that problem first. For some reason, I find this easy to forget, but also easy to learn.

Monday, February 09, 2009

How Confused Am I?

This morning I was thinking about the school semester, and realizing there would probably be a Fall Break. I was wondering if it would just be the week of Thanksgiving, which falls pretty late in the semester, and is thus kind of depressing, or whether we'd just get Thu/Fri off that week (which wouldn't affect me since I don't have any classes on those days), plus a different fall break.

I just went to the school calendar to check this. Imagine my surprise.

Friday, February 06, 2009

Metaphor Songs

There is a type of song I've noticed that I particularly like, to wit: songs that feature a lot of parallel (in some sense) metaphors. I've noticed this largely through KSAL, so I have a feeling that Sally likes them as well. Some examples:

Leonard Cohen's "Is This What You Wanted?"

You were Marlon Brando,
I was Steve McQueen.
You were K.Y. Jelly,
I was Vaseline.
You were the father of modern medicine,
I was Mr. Clean.
You where the whore and the beast of Babylon,
I was Rin Tin Tin.

Or how about "If You Were a Bluebird," of which there are many versions (Joe Ely, Butch Hancock, Emmylous Harris...)

If you were a hotel
Honey, you'd be a grand one
But, if you hit a slow spell,
Do you think you could stand one
If you were a hotel,
Well I'd lean on your doorbell
I'd call you my home

If I was a highway,
I'd stretch alongside you
I'd help you pass by ways
That had dissatisfied you
If I was a highway,
Well I'd be stretchin'
I'd be fetchin' you home

Or there's Butch Hancock's "Like a Kiss on the Mouth", which I'll give a good chunk of lyrics for (especially since I can't find it on Youtube):

A sky full of fire wheels a-burnin' my heart
A handful of moon beams a-stretchin' my eyes
A woman on the mountain says I gotta lay low
And a woman on the river says the water's gonna rise
And the Earth's gonna shake, the sky's gonna fall
The sad face 'n the glad face are painted on the wall
One's a cryin' in the North
And one's a smilin' in the South
Your love sticks with me like a kiss on the mouth

There's a big city wind whistlin' at the women
A sign above the back door about to blow down
The woman in the alley wants me to hurry up
And the woman on the highway wants me to slow down

And the Earth's gonna shake, the sky's gonna fall
The freight plane and the jet plane are painted on the wall
One rollin' North, one flyin' South
Your love sticks with me like a kiss on the mouth

The farmer's from Dallas and the freak is from Frisco
The wino's from nowhere and the cook's from Japan
The woman at the window, she waves without thinkin'
And the woman by my side got my heart in her hand

And the Earth's gonna shake and the sky's gonna fall
The red bird and the blue bird are painted on the wall
One flyin' North and one flying South
Your love sticks with me like a kiss on the mouth

Obviously some artists are much more prone to writing songs like these than others, and I think they tend to be the kind of folksy, verbose songwriters that I often like. John Denver's "Annie's Song" is a simpler version of the same thing - I like the song, lthough I'm not sure it hits this precise button, since it's not very clever:

You fill up my senses
like a night in the forest
like the mountains in springtime,
like a walk in the rain
like a storm in the desert,
like a sleepy blue ocean
you fill up my senses,
come fill me again.

Incidentally, I have a strong tendency to hear the John Denver lyric as "like a knight in a forest," which is a much richer idea for me, though I realize it isn't very Denver-like.

Work Process Considerations

I am always interested in noticing strategies for maximizing one's performance (alternately, minimizing one's effort) at work, and today I was thinking about two related strategies: error and change management. I wrote once before about parnas partitioning (writing code in such a way that it will be easy to change in the obvious ways later), and this is related, but not specific to computer science.

One question to ask yourself when you have to choose a method to accomplish something at work is, "How easy will this be to fix if when I screw it up?"

For instance, a coworker recently had to update 100 records in a program that has an Access database backend. Had it been my project, I would have gotten the identifiers for the 100 records, put them into Excel, put the new field values next to them, imported the spreadsheet into Access, and then run a query to update them. What she did instead was to open each record individually in the program, and do each update. This would make me crazy to begin with, but it also had the unfortunate result that, once she realized she had made a mistake, she had to do it all over again. If you make a mistake in my plan, you can easily just correct the Excel spreadsheet and reimport it, or fix the import query, or whatever is required. The data is entered once and it's stable.

This kind of technique is important to me because I make a lot of mistakes. I bet other people do too.

The second question to ask yourself is, "How easy will this be to change when they want me to change it?"

I try never to change something such that I can't pretty easily change it back, since "Put it back the way it was" is such a common request. I make new data rather than overwrite old data where appropriate. And I try to keep my changes somewhat modular, so that if they want to keep some changes and discard others, that too is possible. In your specific job, you probably know what types of changes are commonly desired, so you can set yourself up to make those as easy as possible in advance. It saves a lot of frustration and grumbling (on your part) later if you can treat changes as expected rather than aberrant.

Some common ways of making changes easier include making sure there are backups of old files, storing intermediate results, and using notes and/or naming conventions to keep things clear. You will definitely not remember, three months from now, how you generated this file or what you did to it, so make sure you give your future self a way to recover that information.

Here ends installment eleventy-seven in the Tam's Obvious Work Advice series.

Thursday, February 05, 2009


Ed commented the other day that "never" is a good substitute for "infinity" in thinking. I had never thought of that before, and I think it's a very neat idea.

You can apply it to my previous post. Are you skeptical that two parallel lines meet at a "point at infinity"? What if we say, instead, that they meet "never." Sounds pretty good.

Similarly, the value of the function y = 5 - 1/x (graph at left) approaches 5 as x approaches positive infinity. When does it reach 5? "Never."

See how that works?

The Extended Euclidean Plane

Here is a little bit of fun geometry that isn't too hard to understand (I promise).

As you probably remember or can easily confirm, in regular (Euclidean) geometry, any two points determine a unique line (that is, there is exactly one line that goes through both). And two lines either cross each other one time (that is, they have one point in common), or they are parallel and never meet.

When we talk about "the Euclidean plane" (which is just the usual flat space used in normal geometry), one way to define it is this:

  • A point has two coordinates (x, y), each of which is a real number (as shown on the right).
  • A line has the form ax + by + c = 0 for some real number values of a, b, and c. For instance, defining a line as "y = 2x + 4" is the same as saying "2x - 1y + 4 = 0".
  • A point is on a line (and the line contains the point) when the point's x and y coordinates satisfy the equation for the line. For instance, the point (1, 6) is on my example line above because 2(1) - 1(6) + 4 = 0.
In the geometry course I'm taking, the definition of a particular geometry follows this pattern: you define what the points and lines are, and how they intersect.

What we talked about last night is the extended Euclidean plane, which exists in order to get rid of the annoying concept of parallel lines. (They're "annoying" because they muddy up some theorems, which I won't get into.) The extended Euclidean plane is different from the normal Euclidean plane in that any two lines that are parallel in the Euclidean plane are said to meet at a "point at infinity." Every class of parallel lines (that is, any set of lines that are all parallel to each other, or all of the lines with the same slope) has a unique point at infinity at which all of the lines meet. And all of the different points at infinity make up the "line at infinity." Well, why not?

So, the extended Euclidean plane could be described like this:
  • The points include all points of the Euclidean plane, plus a point at infinity corresponding to each class of parallel lines (alternately, corresponding to every slope).
  • The lines include all lines of the Euclidean plane, plus the line at infinity.
  • Euclidean lines contain all of the points they would in the Euclidean plane, plus the point at infinity corresponding to their parallel class. The line at infinity contains all of the points at infinity.
This leads to at least one nifty result. Now, in addition to this:
  • Any two points determine a unique line.
we also get this:
  • Any two lines meet at a unique point.
These statements are "duals" - formed by changing points to lines and collinearity (being on the same line) to concurrence (meeting at a point).

Fun stuff!