Monday, June 27, 2005

College: Freshman, Sophomore

I divide my undergraduate years into two distinct periods. My living environment, course load, and social interactions all changed between my first two years and my last two years of college. I changed, too.

During my freshman and sophomore years, I lived in Denton Hall, one of the massive high-rise dormitories on the UM campus. To be specific, I lived in 6107 Denton Hall. I roomed with Pete, a friend since high school.

Denton was a giant brick of a building, eight stories tall with two wings per story. There was a men's wing, and a women's wing, with one bathroom each. Between the wings was the elevator lobby, which opened onto the floor's common lounge and study area. The common area had blue carpet, the type you might find in an office building, and heavy wooden furniture. The individual rooms had walls made of cinder block, painted in shades of pastel blue, yellow, and green. The floors of the rooms, and indeed of everything save the bathrooms and the lounge, were covered with generic off-white tile. The doors were heavy and, together with the thick walls, provided some shielding from an environment which might otherwise have been unbearably loud. The building was steam-heated, with a radiator in each room, and the upper floors were noticeably warmer than the lower floors. There was no air conditioning, but -- despite the heavy construction -- opening the windows often provided enough breeze to make things bearable during warm days. I think the over-riding design goal for the dorms was to make them student-proof, but they were reasonably comfortable, too.

Our floor was almost entirely populated by students in the University Honors Program. A disproportionate fraction of us were in technical majors, particularly engineering. Denton 6 was a coherent social unit: we had classes together, ate meals together, played games together, listened to music together, watched movies together at the campus theatre. Most of us weren't party animals, which I think contributed to our social cohesiveness. The handful who were interested in general partying spent a lot of time outside; my understanding is that they went to visit fraternities and sororities which were more to their taste.

I got to know people fairly quickly in the first week or two as a freshman. Usually, I might have been more reserved, but I was driven by the pressure to socialize and to find friendly faces in an unfamiliar environment. Wait -- who am I kidding? I was driven, as I so often am, as much by hunger and technical expertise as by anything else. My metabolism then was faster than it is now (not that it seems particularly slow now), and as often as not, I was ravenous by the time a group would be ready to go to dinner. Maryland's dining hall food is not bad as far as such food goes, but others found more room for pickiness than I did. So I ate their leftovers. At least a few people probably remembered me, at least at first, as the guy who kept accumulating other people's plates of leftovers at dinner.

More people might have remembered me as the guy who could get the network to work. I knew how to troubleshoot computer problems, and was happy to do so; enough people got to know this that I was able to help a number of strangers living on different floors, and some in different dorms. It was a great way to meet people, particularly since the hardware and software environment common at the time made it so that even simple troubleshooting often took some time. Many machines had no network cards, so one had to be installed (no sweat, usually, though I came to hate certain types of cases). The available network cards came in a zillion flavors, most of them quirky. Windows 95 wasn't out yet, so installing a network card usually involved installing a device driver, and then figuring out why the driver didn't quite work. Conflicts for interrupt request numbers were common. It usually wasn't difficult, but it was time consuming, and it looked impressive. So I worked, and I talked to people. I think I was hit on once or twice, though I didn't come to that thought until about two years later (and still am not sure). Mostly, though, I just listened, talked, and fiddled.

Do any of us really appreciate how we're seen by others? I know I have personal quirks, probably more than I've consciously catalogued. Every semester while I was an undergraduate, I went to the CS division to get my courses approved, and Gwen Kaye always commented on my green backpack; when, at the end of my junior year, I replied that she'd said this every time I came to see her, she said, I know, but it bears repeating. I had a favorite tree on campus, which I liked to climb, and to nap in at times. I was fond of tea, and -- as now -- I had a special appreciation for those who were willing to take the time to share a cup. Acquaintances could tell when I was tired by the way my left eyelid drooped, when I was doing math by the way my hair stood on end, and when I was thinking about a program by the way I draped my arm over my head. What of these things really goes into a first impression, anyhow? Do any of them? Or are a smile or a tone of voice all the impression that lasts?

I remember drinking tea, playing board games, and waxing philosophical with Pete and Scott. I remember watching endless networked computer games; I usually failed to participate, partly because I would be easily distracted, partly because I was never much good at any game but Tetris. I remember playing combat Tetris with Rob and talking math with Mike. I remember listening to Nils' laugh, and some conversations we had over tea. Pete was popular with the women on the floor, and I remember being amused as I watched his interactions with them. I remember that Cindy and Helen and Scott studied together for some engineering course that they were all taking. I remember answering questions from Elea when she was grading calculus homeworks. I remember Will's visits, and how happy I was to discover that Liz liked tea as much as I did. I remember watching the antics of the squirrels. These were the elements of my day-to-day life.

There was the other side of social life, too. We all got on each others nerves at times, and I'm sure I irritated others as much as I felt irritated. On weekends, the elevators often smelled like vomit. Sometimes the bathrooms did, too, and I remember a weekend evening were we had an unpleasant encounter when I asked a group visiting the seventh floor if they could please stick to smoking and drinking in the seventh floor bathroom, and leave ours alone. I remember being rudely awakened from time to time, when a drunk guy knocked on the door to ask whether we'd thrown something at him (I told him we hadn't, and went back to sleep), or when someone pulled the fire alarm. I tend to bolt awake when startled in my sleep, and I think it made Pete twitchy after the first time he saw it. There were some successful courtships among my peers, and there were many that fell flat and turned bitter. People were always stressed over some thing or the other: overwork, perceived or real slights, and life's little mishaps. Shit happens, after all. My Aunt Eva died at a time when I was already feeling bleak; I tried to talk about it once or twice, failed, gave up, and worked through it myself. Such is life. The good times dominated the bad, at least for me.

I think I felt the most appreciation for these social aspects of life during the times they were absent. In the summer between my freshman and sophomore years, I lived on campus, and did programming work for the campus Department of Communication Services. Mike worked at the same place, so I talked with him; I talked from time to time with my apartment mates in the summer housing (particularly a cheerful ME named Ecton, who liked to talk about computers); and I sometimes had dinner with Kathy, who I think may have been dubious about my ability to feed myself. I enjoyed eating lunch outside and watching the squirrels, and I enjoyed eating berries off the tree on my way home in the evening (sometimes I would eat nothing but those berries, which I think may have inspired Kathy's doubts). And I took classes, which meant that I had homework to fill the evening hours. I also installed Linux that summer: it was a disaster the first time, but I got things working eventually. Still, it turned out to be a quiet, lonely summer.

However much I may have been affected by the general setting of a big university and the social environment of the dorms, though, I think few of the life experiences of those first two years had nearly the effect on me that my coursework did.

In educating their undergraduate majors, the department of mathematics at Maryland takes an utterly different approach than the department of computer science. Partly because of the sheer number of undergraduates entering the program, the first two years of the computer science program were fairly regimented. The prerequisites were enforced; the paperwork was carefully checked; and we all marched together in lockstep through the same course sequences, with massive attrition over time when people decided that programming a computer might be more trouble than it was worth, and transfered to other majors (most often business, from my observations). Projects were graded semi-automatically: we used an automated submission system to turn in a package containing sources and Makefiles, and the script kept careful track of the time so that your grade could be appropriately docked if you were ten seconds late. The submitted sources were passed through a grading script, which would run our codes on a set of test cases, and then run the results through diff. If the results didn't match, a grader would look at our output, look at a list of mistakes, and take off a specified number of points. Formatting error: five points. Program crash: rather more than five points. Sometimes class attendance was mandatory, and was enforced by quizzes. For those first two years, my computer science coursework was more a matter of patience than anything else.

In mathematics, there was a program set up to lure promising-looking students into becoming mathematicians. Incoming freshman were offered the chance to take a year-long sequence in analysis: honest-to-goodness hard analysis. None of us had any idea what we were getting into, of course, and the class attrition was rapid and severe. Our class started the first semester with about 35 people, I think, and had about twelve at that semester's end. But many of us who made it through the first semester were thoroughly hooked; and I think all of us who made it through the second semester were. After that, the prerequisites -- which were more suggestions than laws in any case -- were a non-issue. If you could hack it, they were happy to have you; and if you couldn't hack it, you'd either figure it out or you'd go and find something else to do with your time. There were plenty of people around the department who were happy to provide course advice, and their advice was rarely conservative. I once asked my analysis professor whether a particular course would be worthwhile, and he responded, Bah! That's okay, but too basic; you should just take the graduate course. Look, here's the book. My guess is that you could probably go through that in a weekend. Maybe two weekends if you decided to go drinking. So I took the graduate course evantually -- I think all of us who went through that analysis sequence took at least one graduate sequence, which was in any event part of the requirement for the departmental honors program -- and it was excellent.

Of course I loved math. How could I not? It was beautiful stuff, concise and deep and powerful. I remember problems from my differential equations class which took two or three sentences to describe, perhaps a page or two to analyze, and two weeks of thought to finally get. And much of that thought ultimately turned up ideas which I thought were interesting and beautiful in their own right -- which was good, because often they were dead ends for the problem I was thinking about. The way one learns mathematics is to do mathematics, and if you manage to crunch through from problem statement to problem solution without taking a few side trips and admiring the scenery on the way, you've ultimately missed the opportunity to do mathematics. Three quarters of the time, the exploration I did had no immediately obvious connection to the solution (which as often as not came to me on falling asleep or on waking up). But if I didn't do the explorations, I didn't figure out anything: not the problem, not the interesting side roads, not any interesting corollaries.

As far as computing went, I still found the computer fascinating, and spent time exploring the things it could do -- but those explorations weren't usually inspired by my coursework. The big exception was my algorithms class, which I took in my second year, and which (not so coincidentally) was as much a math course as anything. Fortunately, the CS courses got much more interesting later on, but that's a story for another time.

And then there was the breadth coursework, what UM referred to as the Core requirements. I took an honors section of psychology, which was great fun (a giant lecture would likely have been much less entertaining). I took linguistics, which I thought was fascinating, and which some of my classmates found sufficiently intriguing that they took double majors: CS/linguistics or math/linguistics, mostly. And over the summer, I took the required tech writing course.

I remember tech writing not so much for what I learned about how to write as what I learned about how other people write. Slipshod grammar and punctuation and questionable spelling is irksome, of course, but some of what I saw in that class was appalling. One classmate submitted ten pages of typeset drivel in response to an assignment to write a hundred word technical abstract; another fellow, though he seemed sharp and articulate when he spoke, submitted some papers which -- had I not seen the title -- I might easily have mistaken for bad translations of a Chinese typewriter repair manual. We had to read each other's papers, and write comments; I gave the author of the ten page abstract a copy of the directions, with the first two sentences underlined, but I wasn't sure what advice to give the other guy, except that he should read what he had written aloud, first to himself and then to a friend. He told me, with surprising good humor, that he would do exactly that; but I never had to read any of his other work, so I don't know whether the advice helped him or not.

And then there was the Honors coursework. There were three types of course offerings that were unique to the University Honors Program: Honors versions of standard courses, such as the psychology class I took; the Honors colloquium, a one semester peer-led class which was required in the first semester; and the Honors seminars. The introductory psych class was the only honors section of a regular course that I ever took, and I enjoyed it. The colloquium and the seminar were more interesting.

The idea of the colloquium seemed reasonable enough -- to help ease students into the university environment -- but I have mixed feelings about how it was implemented. I suffered through my section, and was glad to be done with it. For the most part I tried to be a civil, thoughtful participant in the discussion; but the discussions didn't always stay at all civil or thoughtful. I remember once getting so upset that I stormed out in the middle of class. In the same situation, I would do it again, now, though I might be more quietly. What bothered me most was the identification of individuals not by their own varied actions, but by their relation to one big idea or action. The same thing bothers me about much organized religion. Doesn't the idea of visiting the sins of the father even unto the seventh generation sound a bit ludicrous? And yet I met people -- very intelligent people, even -- who could, with a straight face, claim that I (apparently personally) had been busy raping, torturing, plundering, and generally being unpleasant for the past few centuries. I could utter no argument to convince them otherwise, at least not that day; they knew the Truth. What would be the point in making a stand? I'm sure I could amuse myself by stringing together bad metaphors, something about the combination of it being easier for faith to move mountains when exaggeration has made a mountain out of a molehill. But really, I'd rather be thinking about math.

And the honors seminars? Ah, they were interesting. There was a very popular one on dinosaurs, taught by a local expert working (if I remember correctly) with the Smithsonian. I saw him lecture once, and it was terrifically interesting; Pete took his seminar, and I gather that it was interesting, too. Another popular seminar was on death and dying; Scott took that one, and spoke highly of it. One of my math professors was passionately interested in opera, and taught a seminar on opera appreciation. I took a seminar on 20th century physics, which was half about the physics (at a high level) and half about the sociology of the physicists; this is where I first read Kuhn. In my first semester, Sandy Mack taught a seminar on Shakespeare; it looked immensely interesting, but it conflicted with the analysis course.

I took five seminars. I already mentioned the course on the evolution of modern physics (From Crisis to Chaos). All the other seminars were chosen to fulfill Core requirements. There was a course on Buddhism. The class met 7-9 in a room that was usually kept at an uncomfortable temperature, and the professor spoke in a soft monotone. I spent most of the lecture hours trying to stay awake, but at least the reading was interesting. I had more luck with the course on Reading the Bible as Literature. I liked that class, which involved a great deal of analysis of who might have written different books (we restricted our attention to the Old Testament), and for what purpose. Did you know that many scholars think the book of Jonah is a satire? Or that the way that Moses is a jackass for half of Exodus and Aaron is for the other half is thought to reflect political divisions between northern and southern Israel? There was one literalist in the class, but he had a sense of humor, and had mastered the trick of keeping two or three mutually contradictory pictures in his mind simultaneously without apparent discomfort. He was entertaining in the class discussions.

Then there was Reading People and Places, which was a course about themes of visual design, from architecture to parks to clothing. One weekend we spent a day walking about DC and examining the architecture of the different buildings; that was a lot of fun, though the professor kept up a brisk clip for the entire day, and I was glad for my long legs. We talked about semiotics and read articles by Roland Barthes. I remember only tidbits about that, probably because I never felt that I had a comfortable grasp of it. Evidently my understanding was good enough to get me through the essays, but the science of signs never seemed to me to be particularly scientific, nor did the language of signs seem to have much in common with language. I remembered enough that I recognized Barthes' name when he died a little while ago, and roughly remembered what I'd read about semiotics. But it has been eight years, and I've forgotten a lot of details.

And then there was Knowledge and Its Human Consequences, which, when I took it, was being offered for the first time as an experimental course. There was some discussion of whether it should be made a mandatory part of the Honors program, though I don't know if it ever was made mandatory. The class isn't easy to describe. There was a lecture part of the class, in which we heard about Gandhi's opinions on modernity; about Dostoevsky's story of the Grand Inquisitor; and about Olmstead's work on the design of Central Park. Each set of lectures was given by a faculty member from a different department. Those same faculty members also led the discussion sections. I was in the section led by the professor who spoke about Dostoevsky, as I recall, as was Pete. I remember finding the discussions alternately interesting, irritating, and upsetting, but I no longer remember the details. I know that part of what irritated by was unbudging Idealism of some of my classmates, but I've forgotten all the specific instances. But I also remember that the discussions were generally lively, which I think reflects well on the professor as well as the class. I was impressed, too, that she read our weekly essays with some care. If she found a point particularly interesting, she would sometimes jot a note in the margin; the only such comment that I remember now, though, is when she told me You write beautifully, but do you always have to be so relentlessly linear? I did not have a good response then, and I still don't.

For two years, I saw the same people in the dorm where I lived, and in the general coursework we all took. Then, in the fourth semester, the coherence of the floor as a social unit dissolved. Some people formed couples and spent their time with each other; others spent time with different groups of friends; and others, inspired by the accumulation of social friction over time, retreated into cliques. We planned our respective moves to different parts of campus where the dorms were nicer, and we planned more concentrated coursework in our major areas. The end of sophomore year was a little ending, and I welcomed it.

Then came two more years, which perhaps I'll talk about some other day.

  • Currently drinking: Lychee-flavored black tea

Thursday, June 23, 2005

Duality and Tensors

A little while ago, I wrote about the idea of dual spaces, and how the idea of a dual vector could be represented directly in languages like LISP and Lua, where functions can be treated like any other sort of data. If you remember that entry (or if your page down button works), you'll know that for any real vector space V the dual space V* is the space of all linear functions from V into the real numbers R. We can also talk about the double dual space V**, which is the space of linear functionals on V*. There is a natural way to embed the original space V into the double dual space V** by means of the evaluate at operation: if v is in V and f is in V*, then eval-at[v] in V** is defined by

eval-at[v](f) = f(v).
(Here, and for the rest of this entry, I will use square brackets for the arguments to a function which produces another function.) For most spaces of interest, including all finite-dimensional spaces, the eval-at map is onto. That is, the two spaces are isomorphic: every element of V** can be represented as evaluation at some element of V. This property is called reflexivity.

If you like Dirac notation, the vectors are kets and the dual vectors are bras. If you don't like Dirac notation, you may here take a moment to chortle in amusement at the notion that theoretical physicists spend a lot of time staring at bras. You've heard the joke about the wave vector for Schrodinger's cat, right? The cat in the ket? Anyhow, if you prefer to think about representations of vectors as rows and columns of numbers, then you might write the components of an ordinary vector as a column, and those of a dual vector as a row.

So: I have vectors, and I have dual vectors, and I have double-dual vectors which are identified by ordinary vectors again. All I've done is to take something I know about, a vector space, and look at some special type of functions whose domain is that space. All I've done, I say, as if the idea of going from the examination of structures to the examination of functions on those structures wasn't one of the most pervasive and subtle ideas of modern algebra! So far, though, I've only looked at functions of one variable. What happens if I start doing the same manipulations with functions of more than one variable?

What happens is that I get multilinear algebra, sometimes known as tensor algebra. A linear functional from V into R is a dual vector, or a type of rank-one tensor. A multi-linear function from V cross V into R (that is, a function which is linear in each slot independently) is a type of a rank-two tensor. More generally, I can talk about multi-linear functions mapping a list of vectors and dual vectors into R; these are tensors. The rank of a tensor is just the number of arguments (there is a completely different concept of rank that also comes up in tensor analysis, so if this doesn't match what you thought rank was, relax).

What happens if we think about a multi-linear function one variable at a time? What happens is that we see very familiar things. Suppose I have a tensor A which maps V* times V into R. What happens if I fix the first component? That is, what if I define

g[u](v) = A(u,v)?
The function g[u] is a linear function from V into R; that is, g[u] is in V*. Similarly, suppose I have another tensor B on V* time V, and I can freeze the second component to get a function in V**:
h[w](v) = B(v,w).
Now I have something in the vector space V* and something in the dual vector space V**; my knee-jerk response is to evaluate the one at the other. That is, can I say anything interesting about the function from V* times V** into R defined by
C(u,w) = h[w](g[u])?
Yes, I can say something very interesting: C is again a rank-two tensor on V* times V** (or, by employing the natural isomorphism between V** and V, it becomes a rank-two tensor on V* times V). We call C a contraction of A and B. You have seen this before, though you may not recognize it as written here. A, B, and C can be viewed as linear operators from V into V; for example, we have
linear-op[B](w) = eval-at-1(h[w]).
Viewed this way, linear-op[C] is the composition of linear-op[A] and linear-op[B]. If you prefer to choose a basis and think in terms of coordinates, matrix(C) = matrix(A)*matrix(B).

The ideas that I've sketched above work for tensors with more than two components, and you can apply them repeatedly in order to talk about double contractions and so forth. You can even contract different components of a single tensor against each other. For a rank two tensor, this self-contraction is called a trace -- in matrix terms, it can be thought of as a sum of the diagonal elements, or as a sum of eigenvalues. One advantage to a coordinate-free development of tensor ideas is that statements like the trace of a matrix is invariant under similarity transformations to the matrix become tautologies. Of course the trace doesn't depend on the coordinate system; you don't even need a choice of basis to define it! Beside taking traces, another common tensor operation is to raise or lower some index -- that is, change a tensor whose kth argument is in V into a tensor whose kth argument is in V*, or vice-versa. If V has a dot product, there's a natural way to achieve this transformation: the dot product is a rank two tensor on V times V, and raising and lowering indices just involves contracting with the this tensor. Or, if you prefer, you can use the dot product to define an isomorphism between V and V*, and raising or lowering the kth index just involves composing the tensor with this isomorphism in the kth argument.

Isn't this fun? I could do it all day... and some days I do. And all this beautiful mess rests on a single idea: the idea of a dual space. The difficulty of tensor algebra is not that the basic idea is difficult: it's a deep idea, but ultimately not a complex idea. The real difficulty of tensor analysis is notation. We usually write from left to right, and we have a simple mental model of the notation for function evaluation: inputs come in on the right, and go out on the left. If you're comfortable with linear algebraic notation, you might not even bother with any special symbol to indicate that operations are composed: you might just write the composition of operators A and B as AB. We could draw a graph with arrows pointing from inputs to outputs, and it would form a straight line; for more complicated problems in which functions can have multiple inputs, it would form a tree (a parse tree for the expression, if you like). When we introduce the idea of duality, this mental picture gets confused: if I have a functional f and a vector v, should I draw an arrow to indicate that the vector is an input to the functional, or (using eval-at) should I draw an arrow to indicate that the functional is an input to the vector? When I introduce higher-rank tensors things get even more complicated. If I were to draw a graph to denote the flow of information in a general tensor contraction, I would not only have no idea which direction the arrows should point, but I would have to allow the arrows to form a topology much more general than a tree (if done in the obvious way).

So how do you actually compute with tensors, when it's so difficult to denote what's acting on what? You give labels to the arguments, and give rules for how the labels connect to each other. Usually this is done at the same time one chooses a basis: the result is indicial algebra, which is very natural for computation, but which hides the real nature of tensor algebra (and wreaks havoc on one's eyesight). Another way to denote how tensor contractions work is to draw a graph of how arguments are attached to each other by contraction; this approach gives you tensor diagrams. Perhaps unsurprisingly, I learned about tensor diagrams from a computer scientist, not a mechanician or a mathematician: if we can turn a problem into a graph operation, we probably will.

The other thing that I think causes immense confusion is that tensor algebra often is described only briefly as a first step to describing tensor calculus. That step, too, looks and sounds much more complicated than it really is. But this is a topic for another day.

Saturday, June 18, 2005

High School

I visited the campus book store today. I got the book that I was wanted, Becker's Electromagnetic Fields and Interactions, which now sits comfortably next to my copy of Jackson's book. I'll have to return the earlier book by Abraham and Becker on Monday. I was also pleasantly surprised to discover that Electromagnetic Fields is bound together with a second volume, Quantum Theory of Atoms and Radiation.

Book stores are dangerous places, though; you never quite know what will follow you home when you leave. I got two other books: Hackers and Painters, a collection of essays by Paul Graham; and Thomas Kuhn's The Structure of Scientific Revolutions, which I read some time ago, but never got for myself. After I left the store, I sat outside at a cafe for a while, reading, sipping, and watching.

The first essay in the collection is Why Nerds are Unpopular. The essay is available online, and it's sufficiently short that there's not much point in my summarizing it here; nevertheless, I'll quote a paragraph from the setup:

I know a lot of people who were nerds in school, and they all tell the same story: there is a strong correlation between being smart and being a nerd, and an even stronger inverse correlation between being a nerd and being popular. Being smart seems to make you unpopular.

The rest of the essay develops the thesis that high school popularity is a full-time job, and that those folks who are more interested in playing with computers or model rockets than in being popular simply won't be popular.

Wait. Did I go to high school?

Yes, of course I went to high school. I went to an average public high school in the northern part of Maryland. But for many years, I've been bothered by something about my memories of high school; they seem incomplete, inconsistent with the tales told by my friends and by everyone else I know who went through high school around the same time. I remember some very good teachers and some not-so-good teachers and some teachers between, but I seem to remember all of them as generally well-intentioned people who had at least a passing interest in their respective topics. Several of the classes were actually quite entertaining, whether it was from Alfonso the Silky Chicken dancing around our feet in biology, or from Frau Walker illustrating how to do a stage fall in German class, or from being allowed to make a paperweight out of the kidney of Stiffy the Cat in anatomy class (the cats were injected with blue and red latex to make their circulatory systems easy to see, so the network of veins on the outside of the kidney was strikingly pretty). And how could I forget Bob the water molecule? Even some of the duller classes could be amusing: I remember sitting in the back of a class taught by a teacher who had an unfortunately monotonous presentation style, watching the heads of those in the front row bob up and down as they fought off sleep. Every so often the head bobbing would synchronize, and at least once that year I saw every head in the front row -- save one -- droop down and jerk up nearly at once.

I don't remember much physical fighting. I don't remember that I was ever bullied. I don't even remember observing most of my peers treating each other particularly viciously. I'm sure there must have been sex, drugs (or at least beer), and rock-and-roll; only the last came within my sphere of direct observation. There were cliques, but I don't remember anyone who seemed particularly snotty about it. And I was more popular than not, I suppose -- how are such things quantified, anyhow? -- though to the extent that I thought about it at all, I probably would have guessed I was a nerd: I was tall and gawky, and even then my hair was constantly disheveled from a habit of combing my fingers through my hair when I was thinking; I was not particularly athletic; I made no particular attempt to dress fashionably; and I spoke then much as I speak now. I was involved in the quiz team -- mostly as an onlooker, since I was never very quick to buzz in even on the rare occasions when I knew something -- and I sometimes went to math or computer puzzle competitions, but I wasn't part of any of the other standard extracurriculars. I may have nominally been part of some class council or the other, but I only remember once being asked to do anything with it. I wasn't very socially active. I had a part-time job doing programming work, and I spent a lot of my free time programming or playing computer games; I taught myself about topics that I thought were interesting (most of which involved math); I practiced martial arts; I read an enormous amount of science fiction; and the rest of the time I played with the cats, wandered about the woods, or stared into space.

I don't miss high school. I may have been less testy than the average teenager, but that's not saying a great deal; I certainly spent time feeling grouchy at the world without knowing why (though I remember being aware that those feelings were not rational, which helped). College was much more interesting; and, though I love my parents, I was relieved when I was able to leave and live on my own for a while -- and I suspect they were relieved, too. Nevertheless, I remember it as a time that was more happy than not, and while I may sometimes have simply memorized lists of tripe for a test (and then promptly flushed them from my thoughts), I did learn some things in high school.

I had a rich college experience: I learned to be a mathematician, and I learned about some of the very clever things that people long dead thought of, and that people still living continue to think of. I befriended interesting people, worked on fun projects, and generally charged boldly forth. Yes, I also stayed out late, I wandered around in some places I probably wasn't supposed to be (tall and gawky is an excellent shape if one wants to climb over things), and I probably also did some fairly boneheaded things. But I also learned, much more than I did in high school, how cruel, petty, self-destructively stupid people can be. So my general opinion of humanity went down somewhat after high school; and this seems to be the opposite of what happened with many of my peers. Why?

For a long time, I thought that I just wasn't very observant when I was in high school. That explanation is inadequate, though. I think people are fascinating, and I did not suddenly become more curious or observant about them at the start of college. I did have some more opportunities to observe in college, as I was more sociable as a college student than I was as a high school student; and that difference probably has something to do with how I remember high school. Recently, though, I've come to think that my impressions of high school -- and later of life after high school -- are driven by the same observations most other people make, but perhaps interpreted somewhat differently.

High school is an odd environment. Students have little really unstructured time during the ordinary day in which to make mischief (though an extraordinary amount of mischief can be done in a short period, particularly if such mischief is planned out during a particularly boring class). I was lucky enough to have some interesting classes, and to have academic things that I thought were interesting to think about in the not-so-interesting classes; consequently, I spent little time fuming at my situation, stewing over some perceived slight, or trying to mentally figure out who was doing what with whom. On the other hand, if I saw someone acting out of boredom, I could understand, and feel empathy or amusement. At worst, I might find it irritating, but often I could feel some humor at my own irritation. I remember the guy sitting next to me in an art class once stuck his paintbrush in my ear, just because he was bored and wanted a reaction; I didn't jump out of the way as he expected, and I was a little irritated at having my earlobe painted green -- but it was funny at the same time, even if it wasn't exactly something I wanted to encourage. I think he was more embarrassed about my having a green ear than I was. He apologized, I cleaned off my ear, and we got along reasonably well after that.

There are probably other things that I've forgotten which I managed to attribute to boredom rather than to malice or stupidity. I may have felt differently if I were physically bullied, but I never had problems with that, probably due to a combination of the company I kept and the fact that, however bony, I was tall enough that I probably didn't look like an easy target. Then, as now, I tried to be courteous to my peers. Then, as now, I would be happy to talk about my interests when asked, including those interests that might be relevant to classwork. I wasn't going to feel artificially persecuted, and my peers apparently saw no particular cause to persecute me in earnest. And because I didn't spend much time hanging out with people, there weren't really opportunities for me to seriously offend or be offended; nor was I particularly inclined toward gossip. So I had friendly, or at least civil, relations with most everyone I knew. And, of course, I had some very good friends; I still talk to many of them.

In high school, most potential unpleasantness seemed to derive from boredom or from insecurity. It is hard not to feel some sympathetic amusement when observing the disaffected youth of Harford County, as Pete would call them. But I find the insecurity of the disaffected youth easy to deal with in comparison to the earnestness -- and sometimes smugness -- adopted by college students. I met people in college who knew the Truth was that I was an infidel (whom it was their duty to either save or condemn); who knew the Truth that I was an oppressor (Caucasian and male -- what else could I hope to be?); who knew the Truth that I was as good as killing babies abroad or Uncle Sam at home. How can you have civil relations with someone who can't hear you over the roar of a nonsensical Truth? I watched newly independent men and women dealing, alone and sometimes for the first time, with independence and responsibility, love and heartbreak, personal finances, and death. It is not surprising that some turned to some One True Way, others fell apart, and others revealed a dark side -- greed, self-delusion, political sleaziness, and plain malice -- that I could not easily shrug aside. Nor is it surprising to watch as people rise up, cope with life in all its aspects, and reveal that they have virtues beyond what is habitual: strength, courage, intelligence, wisdom, kindness, and native goodness.

Perhaps I was not so unobservant in high school after all. Perhaps I had some sense that school politics and biases were a game, as artificial as football. Perhaps it lines up with the feeling I had even then, that the accomplishments during high school years that I should be proud of -- that anyone should be most proud of -- were at most tangentially related to high school. High school students do live in the real world, but not during school hours. And after high school? Spilled beer on the floor, charred carpet where someone set the furniture on fire, these things are a source of irritation or amusement -- whether the culprit is in high school or college -- but they ultimately signify little. The world after high school has plenty of arenas where people can and do pull pranks or play at popularity. Those just aren't the arenas that I find most interesting.

Of course, it's still possible that I missed a lot of what went on while I was in high school out of an absent-minded lack of observation. That would be okay with me, too.

Wednesday, June 15, 2005

Tuesday, June 14, 2005

A Matter of Tone

Usually when I receive requests for help with software, they are neutrally phrased. Sometimes, though, they are incomprehensible, impolite, or both. It's hard to do much about the incomprehensible questions, except to reply with an e-mail that might be briefly summarized as eh, wozzat?; but for the deliberately rude or insulting requests, I sometimes will suggest some ways to get more useful support.

Monday, June 13, 2005

Pines and Signs

I got my new glasses yesterday morning, and since then I've been admiring the world's sharp edges. My vision isn't terrible, but I am more myopic than I was when I got my last pair of glasses (eight years ago?). I'd noticed in the past couple years that I was having increasing difficulty reading street signs and seminar slides, but I did not notice that the needles on the upper boughs of the local firs had blurred together, nor that the dish antenna atop one of the local buildings had ceased to look like a mesh. But now I can see these things again! I went to El Cerrito in the early afternoon to retrieve a book from a friend (Frankel's Geometry of Physics), and walked back home, enjoying the sun and the trees and the fact that I could read street signs at a distance. I'm sure that in my peering about I looked slightly daft, and I don't care.

Of course, now I can see how dusty the corners of my room are...

  • Currently drinking: Coffee

Saturday, June 11, 2005

Programming and Duality

Vector spaces are like potato chips. You cannot have only one.
W. Kahan

One of the key ideas in linear algebra is that of a dual space. If V is a finite-dimensional real vector space, then the dual space V* consists of all linear functions from V into the real numbers. A function from V into the real numbers is sometimes called a functional on V, so we also sometimes say that the dual space is the space of linear functionals on V. If V is a finite-dimensional inner product space, then there is a natural map between ordinary vectors and dual vectors: every function f in the dual space V* may be written as

f(x) = dot(y,x)
for some unique choice of y in V. This is a special case of the Riesz representation theorem.

Dual vectors can be identified with vectors in V, but they are not the same. Usually, we remind ourselves of the difference by writing vectors and dual vectors as columns and rows of coordinates, respectively (if you're a physicist, you write kets and bras; however, I was not exposed to Dirac notation until after my formative years, and tend not to use it except when making puns). The difference between vectors and dual vectors matters as soon as one tries to change coordinate systems, for instance. If you have ever seen the multi-dimensional chain rule, you have seen this distinction: if F is a nonlinear function from V into the reals, then (dF/dx)(x) is actually a dual vector, and so the chain rule looks like

d(F(Ax))/dx = (dF/dx)(x) A.
The gradient vector grad F(x) is the vector in V which identifies dF/dx(x); this vector transforms like
gradx F(Ax) = AT gradx F(x).
Fortunately for me, I learned about this distinction early in my career; this knowledge has doubtless saved me from hours of wondering whether I needed to transpose a matrix or not, hours which I could instead spend wondering whether I'd made a sign error somewhere.

What have dual vectors to do with programming? I think that the notion of a dual vector sometimes confuses people because they are unused to the idea of manipulating functions as interesting mathematical objects in their own right. Even for those who find the idea of a dual vector natural often are confused by the idea of contravariant and covariant components in a tensor -- though it's really the same idea. Certainly I found it confusing initially! The same source of confusion applies, I think, when people first learn about functional programming. A function can be a valid object of mathematical and programmatic manipulation: a simple enough statement, but oh! the confusion it causes.

In an attempt to reduce the confusion for at least one or two people, I have been thinking about how to describe dual vectors in a functional programming language (or at least in a programming language that allows a functional style). For this exercise I will use Scheme (a LISP dialect) and Lua (one of my favorite scripting languages). I start with functions to compute the dot products of two vectors. In Lua, I would represent a vector as a table: if x is a vector, then x[i] is the ith component of the vector. Using this representation, I can compute the dot product of two vectors with this function:

  -- Dot product of two vectors (Lua version)
  function dot(x,y)
    local sum = 0
    for i,xi in x do
      sum = sum + xi*y[i]
    return sum

In Scheme, I represent vectors as lists (we'll ignore Scheme's native vector type for the moment). To compute the dot product of two vectors, x and y, I use the following function:

  ;; Dot product of two vectors
  (define (dot x y)
    (apply + (map * x y)))

It's worth dwelling a moment on the Scheme implementation. The Scheme code computes dot products in two phases. In the first phase, the map procedure is used to apply the multiplication operation to every pair of entries from x and y. The resulting list of elementwise products is then summed up in order to get the dot product. Note that there was no need to explicitly specify a loop or a recursion: all that work was done by the map and apply operations.

What if we want the linear functional identified by a particular vector? Because both Scheme and Lua allow functions to be treated as first-class objects, this mapping can be done very naturally. In Lua, we have

  -- Produce a dual vector (a linear functional)
  function dualv(x)
    return function(y) 
      return dot(x,y) 

while in Scheme,

  ;; Produce a dual vector (a linear functional)
  (define (dual-v x)
    (lambda (y) (dot x y)))

The idea is the same in either case: the function dualv returns another function. The returned function is never given a name; in Scheme, such an anonymous function is called a lambda (after Church's lambda calculus, the logical system upon which LISP and its successors were directly based). In Lua, a function is usually just called a function, without the fancy-sounding adjective.

Now, what if we want to go one more step, and define double-dual vectors? Just as a dual vector is a functional on the original space V, a double-dual vector is a functional on the dual space V*. In a finite dimensional setting (and in many infinite-dimensional cases), all the elements of the double-dual are identified with elements of the original space V. A double-dual vector g identified with a vector v acts on dual vectors by evaluation at v:

g(f) = f(x)
Just as we did with dual vectors, we can define Lua and Scheme functions which implement this canonical map between elements of the original space and elements of the double-dual space:

  -- Produce a function x(f) for "evaluate f at x"
  function evalat(x)
    return function(f) 
      return f(x) 

  ;; Produce a function x(f) for "evaluate f at x"
  (define (eval-at x)
    (lambda (f) (f x)))

Now we've written routines to go from vectors to dual vectors or double dual vectors. Let's see a concrete use for these routines. Suppose we would like to produce a linear operator from its matrix representation. That is, we have a list of rows, and each row is a list; these rows represent linear functionals that map an input vector to some component of an output vector. We can produce a function that multiplies an input argument by the matrix using the following very simple Scheme functions:

  ;; Produce a function to evaluate a list of functions
  (define (f-list fs)
    (lambda (x) (map (eval-at x) fs)))

  ;; Produce an operator
  (define (make-linear m)
    (f-list (map dual-v m)))

The make-matrix command first converts each row in the matrix to a corresponding dual vector, then (using f-list) produces a function that applies each dual vector in turn to an input argument, returning the result in another list. Note how f-list takes advantage of the eval-at function. The map routine applies one function to many arguments; by thinking of x not as a vector, but as a function that acts on functions (a double-dual vector when all is linear), we can adapt map to apply many functions to a single argument, which is what we want.

What about a Lua implementation? Idiomatic code in different languages will naturally follow different patterns; in this case, the lack of a map function in Lua (and the naturalness of writing a for loop), suggested the following routine to generate a linear function:

  -- Produce an operator
  function makelinear(m)
    return function(x)
      local mx = {}
      for i,mi in m do
        mx[i] = dot(mi,x) 
      return mx
  • Currently drinking: Rooibos

Friday, June 10, 2005

Physics of Star Wars

Almost exactly a week ago, I got around to seeing Revenge of the Sith. I think I would rather have seen Hero on the big screen and waited to see the last Star Wars installment on the small screen, but it was entertaining nonetheless. Even more entertaining, at least for me, where my falling-asleep thoughts about the movie over the past several evenings, which I will share with you now.

What is the Force? Well, to first approximation we might guess that it is related to the Displacement in the Ether. Yes, I know that the ether hasn't been in vogue for quite some time, but this was a long time ago, right? Besides, Lucas doesn't appear to be terribly bothered by the details of modern physics, which is perhaps just as well -- in our universe, a sword made out of bosons would be pretty ineffective, and relativistic effects would make the chronology of the Star Wars universe much harder to understand. But I digress. The point is that the Force is related to the Displacement, but nobody talks about the Displacement. Why?

One reason why people might not mention the Displacement is because it is terribly small. If the Displacement is small but the Force is not small, then perhaps the Ether is stiff? The stiffer and less dense the Etheris, the faster disturbances in the Displacement (and thus the Force) would travel. In the movies, these disturbances seem to travel very quickly indeed, since events at one end of the galaxy are rapidly detected at the other end. Characters manage to travel from one end of the galaxy to another sufficiently quickly that they can take a fighter craft with no restroom facilities, so perhaps it's not that far -- but again I digress.

I really should non-dimensionalize, but the voice of Yoda echoes in my head, saying Dimensionless constants, you need not. Ridiculous crap, making up you are. Trust your feelings, you should.

So much for the propagation of disturbances in the Force: they are doubtless governed by some wave equation, though it would be difficult to ascertain the nature of the equation without either a Jedi (who would probably ignore me) or a Sith Lord (who would probably decapitate me) to help with some experiments. This brings us to our second question: how are those disturbances in the Force generated in the first place? I have a hypothesis for this as well, which I do not think I could have made before watching the prequel trilogy. Perhaps I got more out of this prequel than I thought.

In Episode 1, we learned that the Force is somehow connected to mitichlonines (sp?), which are like mitochondria but with more mystical significance and less certain spelling. Mitichlonines spend all their time doing jumping jacks inside your cells and making waves in the Force. You would expect, then, that any being sufficiently endowed with mitichlonines would be able to do things with the Force, like lifting a spaceship from a bog or strangling a foe. But what if there's an impedance mismatch between the Ether and the stuff that human beings are made of? If the impedance mismatch is sufficient, then nearly all of the waves generated by the mitichlonines would be reflected back into the being generated them, leaving barely a ripple on the outside world. Thus, most people will be supremely indifferent to the Force, no matter how enthusiastic their mitichlonines might be.

But what if the jumping of the mitichlonines generated a resonant behavior? Then the reflected waves might constructively interfere with each other inside the body, generating fearsomely large trapped disturbances in the Force. Eventually, this resonance might grow to the point where an appreciable amount of it leaked out into the surrounding Ether. Since the resonances of a cavity depend both on the properties of the material in the cavity and the size of the cavity, perhaps it is no coincidence that most of the Jedi Council seem rather stiff -- except Yoda, perhaps, and he's small.

I wonder, if there were a medium with an even greater impedance mismatch to the human body than the Ether, what would happen to the unlucky Jedi trapped in such a medium? Presumably even more of the mitichlonines' energy would go into trapped standing waves. In unlucky cases, might spontaneous Jedi combustion ensue? I'm also inclined to wonder if, when the Displacement is sufficiently large, the wave equation governing the behavior of the Force becomes nonlinear; and, if so, what the nature of the nonlinearity might be.

No, this isn't going into my thesis.

    Currently drinking: Russian Caravan

Wednesday, June 08, 2005

Piano Rain

I do not know the name of the piano piece playing on the radio now, but it is a good accompaniment to the tap of rain on the roof and the occasional swish of a car on the wet pavement. It is a sound I associate with summer rains in Maryland; but for today there is rain in Berkeley as well. This evening I walked to a cafe, and from there to the office, and from there back home. Low clouds shrouded the hilltops; then nightfall hid even the clouds. A sprinkle of rain wet my hair and glasses. When I looked at the streetlights, the drops on my lenses made the light dance.

I notice the smell of rain. It's like the smell of mown grass, or coffee, or women: pleasant, but insistent. I can acknowledge it and allow my mind to pass over it, but unless I'm deeply engaged in some other thought, I cannot ignore it. I don't want to ignore it. A good haiku might smell like rain: simple and familiar and elegant. I listen to the rain on the roof, and I forget the earlier flares of irritation with all the chanted inanities that make their way into the songs and conversations and advertisements and political commentary that I hear in a day.

Peace! An elegant mathematical argument turns on cleverly using a few tools to show a general truth. Physical theories are elegant when they explain much with little, based on a few key ideas which can be expressed mathematically. The principles are simple, though the results may be fantastically complex. Most faces of life are more inscrutable, their simplicity hidden below our fathoming. Complexity is to be appreciated, studied, managed, and understood; but simplicity, when it occurs, is to be cherished. And so I hunt for mathematical gems; and so I listen to the rain.

Tuesday, June 07, 2005

Cartoons and math jokes

I've heard this one already. But I chuckled nonetheless.

Monday, June 06, 2005

More Books

Recently, I've taken less time for light reading than I sometimes do. Oh, I had a grand time with Truesdell's Idiot's Fugitive Essays on Science, and if you can find a library copy, I encourage you to enjoy it as well. But I didn't read much while I was traveling. I did read A Short History of Nearly Everything by Bill Bryson, and I recommend it -- Bryson is funny, and manages to fit quite a bit of information between the anecdotes. And last week, I read Freakonomics by Levitt and Dubner, which left me a bit disappointed; the ideas were interesting, but about halfway through I found myself thinking I should put this book down and read the papers referenced in the end notes. I thought the same thing at the end of the book. I also read two Gemmel novels this week and, a little further back (while traveling?), a recent Modesitt book (the second-most recent Recluce book). Of the novels, I think I preferred the Modesitt book. I'm partial to his writing. Though the didactic tone and the constant use of half-overheard conversations sometimes irritates me, I find Modesitt's habit of describing his character's meals to be rather endearing. Food is so good.

That's about it for the past three weeks, at least for non-technical reading. On the technical side, there's the usual slew of papers plus books on integral equations (Hackbush), SAW devices (Campbell), and electromechanical filters (from the last third of the CRC Handbook of Electric Filters). There, again, it's been a lighter-than-usual reading month, mostly because of travels.

But I've got some stuff in queue now that I think will be a lot of fun.

First, I have Doomsday Book by Connie Willis. I was introduced to Willis when I read To Say Nothing of the Dog, which I thought was great (for the plot, for the characters, and for the writing style); and Willis has won at least four Nebula Awards and two Hugos, so there must be other folks out there who like her writing, too. I also finally picked up Turing: A Novel About Computation, which I have been thinking about reading for a while; it's written by Christos Papadimitriou, one of the professors in the department. I've also seen that the latest installment in George R.R. Martin's series finally has a concrete release date, and I'm looking forward to that. On the more technical side, I picked up Modulated Waves: Theory and Applications by Ostrovsky and Potapov, which is a nicely written text on some one-dimensional wave phenomena (linear and nonlinear) of a type that I keep encountering. Also, this summer I sould like to make my way through Mackey's Mathematical Foundations of Quantum Mechanics, which has been sitting in my queue since February. Perhaps this way I'll finally feel like I understand some more of the quantum mechanical examples that I keep encountering. Not that I think the authors who use such examples to illustrate their eigensolvers actually understand any more quantum mechanics than I do, but still...

  • Currently drinking: Genmai cha

Bus Stop

While at the bus stop on Saturday, I queued up behind a large group of Chinese travelers (they were speaking to each other in Mandarin, at least), most of whom took an awfully long time getting on the bus. I'm not so sure why the rest of them took so long, but I got to witness the whole interaction when the woman in front of me paid her fare. She tried to put in just a dollar, and the bus driver stopped her and explained the fare schedule. She glared at him over her mask and argued ferociously, but he patiently explained that the fares were set by someone else, and he could not haggle over them. She was also, rather to her disgruntlement, far too young for the senior discount. The fare was $3.50 for the Express route, and that was that. So she pulled out a white envelope and very slowly fished out two more bills, which she fed to the meter; then she pulled out a small purse full of change and carefully counted it all before putting in two quarters. She resealed the envelope and the change purse, put them away, and then checked that her bags were closed -- shooting suspicious glances at the bus driver the entire time -- before moving down the aisle so that I could pay my fare.

Needless to say, the bus left late.

Wednesday, June 01, 2005

Things Learned

I learned last week that it's past time for new glasses. So I'm getting an eye exam today, and will proceed from there.

In preparation for walking around half-blinded by dilated pupils, I invested in a pair of sunglasses this morning. There are some people who manage to look classy in sunglasses. For myself, I think goofy is a better adjective. I knew that before, but it's good to be reminded of these things from time to time.

In response to a user request, I'm finally getting around to putting support into FEAPMEX to allow users to define their own elements in MATLAB. Evidently I've learned something since the last time I tried to add such a feature (which must have been a while ago -- there was code there, with a comment saying that it was disabled, but I don't remember writing it). So far a very small time investment (about two hours) has led to a half-completed element -- and the half that's done appears to be pretty robust. At least it exits gracefully, with a useful error message, when I make a mistake.

Of course I learn a little every day. How could anyone help but do otherwise?