jump to navigation

one pi, two pi 29 March 2007

Posted by DSM in astronomy.
comments closed

Beware averaging angles!

I just lost an hour and a half or so tracking down an obscure bug in my visualization code.  Every now and then, Saturn’s F-ring would suddenly decide not to fit on the surface density plot anymore.

(Yep, I’m back on Cassini work — there’s a paper the team wants to submit to Nature in a month, so it’s time for some quick sims studying embedded objects.)

It turned out to be because the simple algorithm I was using to fit an ellipse to the F-ring and straighten it out involved taking the mean of the longitudes of the ring particles’ orbits.  As usual, I’d normalized them (in this case to [-pi, pi]) which tends to avoid headaches.. but it won’t get you out of every problem, and when the angles rolled around, the mean didn’t know about the 2 pi periodicity of trig functions and therefore stopped returning useful numbers.

For the record: average the angles in vector or exponential form to get the right answer.  You can even cast back into trig space and come up with a cute expression if you’d like, which is left as an exercise for the reader.

Karl, set tea for two 28 March 2007

Posted by DSM in politics.
comments closed

Unparalleled independent journalist Michael Totten does it again, with another series of engrossing reports from Iraq.  My favourite part:

Iraqi Kurdistan is technically occupied by a foreign power, but this occupation surely ranks among one of the most absurd in human history. Dr. Ali Sindi, advisor to Prime Minister Nechervan Barzani, told me that South Korea is the official occupier of “Northern Iraq.” Korean soldiers are stationed just outside Erbil in a base near the airport. He laughed when he told me the Kurdish military, the Peshmerga (“those who face death”), surround the South Koreans to make sure they’re safe.

The South Koreans, as present-but-absentee imperalist overlords, being protected by their nominal wards!  You can’t make this stuff up, which is why Totten’s such a treasure.

He also has an interesting story about what happens when you’re planning to meet with the kind of communists who want to sip overpriced coffee and talk trade unions and foreign films and letter-writing campaigns, but due to driver error instead meet up with the kind who use mounted belt-ammunition machine guns and who don’t like the sellout coffee-drinkers very much.

Fortunately everyone comes out of it alive, thanks to the apparently boundless Kurdish hospitality.  In fact, even after the mixup is discovered and the guests are revealed as would-be acquaintainces of the hosts’ enemies, the revolutionaries gave our heroes a tour of the camp!

There must be something in the Kurdish water: even their communists are friendly enough.  Time to bottle it and ship it south, I think.

down with equality 27 March 2007

Posted by DSM in politics.
comments closed

John J. Miller has a dispiriting article on scholastic Leftism gone mad: some Seattle types banned Legos because of the ungood concepts of social injustice that playing with them instilled in the kids. Only after imposing the rules that “All structures are public structures”, that “Lego people can be saved only by a “team” of kids, not by individuals” (whatever that means), and that “All structures will be standard sizes”, were the students allowed to return to “playing”.. or whatever you call it after all the fun has been removed.

I think the last command, that no structure will be bigger than any other, is what set me off, because it’s not merely idiotic but profoundly dangerous if such a lesson is extended to the larger world. It’s even more, well, flattening, than the rejection of private property and individual enterprise in the first commands.

Look: any two things which aren’t the same thing differ in some way, and are therefore unequal. The entire universe is one incredibly large study in the countless ways objects can be unequal, and people are no exception. Some are tall, some are short, some are good at one thing, some at another. These differences among people can’t help but lead to distinct outcomes, whether in significant accomplishments — I’m never going to design a cathedral, or write a symphony — or less significant ones, such as Lego construction.

Teaching students right at the start that being able to do better than other people isn’t a gift which you should put to a useful purpose but instead something to be suppressed lest your capability being realized (both in the sense of being noticed and in the sense of being effected) cause social injustice is inane at best and and disastrous at worst.

Kurt Vonnegut’s unforgettable story Harrison Bergeron says it better than I ever could. Imagine a world where the champions of Lego social justice were in charge, and shudder.

Or, for a more charming but equally thoughtful take, see Brad Bird (which marks the second time I’ve posted this bit — man, I loved The Incredibles):

Helen: Dash, this is the third time this year you’ve been sent to the office. We need to find a better outlet. A more.. constructive outlet.

Dash: Maybe I could, if you’d let me go out for sports.

Helen: Honey, you know why we can’t do that.

Dash: But I promise I’ll slow up! I’ll only be the best by a tiny bit!

Helen: Dashiell Robert Parr, you are an incredibly competitive boy. And a bit of a showoff. The last thing you need is temptation.

Dash: You always say, “Do your best.” But you don’t really mean it. Why can’t I do the best that I can do?

Helen: Right now, honey, the world just wants us to fit in, and to fit in, we just gotta be like everybody else.

Dash: Dad always said our powers were nothing to be ashamed of. Our powers made us special.

Helen: Everyone’s special, Dash.

Dash [sullenly]: Which is another way of saying no one is.

recurrence relation 27 March 2007

Posted by DSM in miscellanea.
comments closed

Growing up in Red Deer provided lots of opportunities for childhood adventures.. I have a lot of great memories. That time also left me with some mysteries which last to this day.

One of them was where the small metal sticks came from in the spring and summer. They’re about twenty centimetres long, half a centimetre wide, and a millimetre thick. They’re a silvery metal but usually look brownish because of the rust. They’re light and quite flexible.

Come the end of winter I’d start seeing them, usually on sidewalks (although since I typically walked on sidewalks, this might be selection effect: maybe they’re everywhere!) and on the pavement near the sidewalk. Sometimes I’d go a week without seeing any, and other times I’d see several in the same day.

I have no idea what they’re for, or why they start appearing. I guess they could always be there and it’s just that you can’t see them in the winter on account of the snow (link for Londoners)..

Whatever their true purpose, apparently it’s cross-continental, because I’ve just found my first one here in London.  Discovering it was oddly comforting; it looks exactly like the ones back home.

I have a vague impression that someone once told me what they were for, and I think I believed them, but now I can’t remember. The best I can come up with is that they’re a part which typically falls off lawnmowers or those sweeping machines, and yes, I see the problems with that theory..

Huh.

princes kept the view 27 March 2007

Posted by DSM in television.
comments closed

Who would have thought? Of all the terrible shows that could rise phoenix-like from their own ashes, Battlestar Galactica not only did so but is in serious running for the best television show being made today. Note I didn’t say best science-fiction show.

A friend mentioned a while back that she didn’t care for it because it took itself so seriously. But that’s exactly why I like it so much: those involved have enough confidence to play it straight and trust that the strength of the stories will carry it forward. And it does. I don’t have to apologize sheepishly for liking the show because I like seeing spaceships shoot at each other.. instead I get to gently chide everyone who’s not watching it for missing out on some impressive storytelling, and that’s a delicious change from the norm.

So for my fellow BSG fans: a great story of a lucky guy who visited the Vancouver set, complete with photographs. No real spoilers that I spotted, but I wouldn’t read it unless you’ve seen S3E20, just to be on the safe side.

BTW, I have an unfinished post floating around which explains how I’d have salvaged the not-quite-classic Labyrinth. Maybe I should get around to completing it. If you can save BSG, you can save anything.

it’s whisper quiet 26 March 2007

Posted by DSM in daily life.
comments closed

A few weeks ago, Carl Murray gave a public talk on the history of the Cassini mission. I thought it would be a good idea to go, not only because he’s a good speaker, but because I was giving a lecture on ring dynamics the next day and might pick up some helpful analogies.

During question period, one guy particularly annoyed me. First he introduced himself (Someone So-and-So) and explained that he was the chair of the local society of amateur astronomers. Then he offered Carl some fawning praise, and said that he hoped that no one would mind if he digressed into politics.. at which point he explained how much of a waste he thought the London Olympics would be and how much better use the money could have been put to by investing in several more Cassini-like missions. He asked Carl’s opinions of this idea, and his response — the correct one, of course — was “No comment.”

I thought of asking the next question myself: “I’m new to this country, so please excuse my ignorance of the local dialect. Is there a word for self-important jerks who hijack public discussions because the world desperately needs to know more about their pet causes even in an unrelated forum?”

This guy scored the trey. He introduced himself, to make it about him. He offered inappropriately-timed, awkwardly ingratiating praise (that it was accurate isn’t relevant), embarrassing the speaker. And then he used the “question” as a soapbox to rant. I can’t speak for anyone else, but it certainly made me uncomfortable.. and I’ve long since thought that the Olympics have grown too large and could do with being cut down by a factor of ten.

No one was going to be convinced by his “question”, and he must’ve known it, so it wasn’t about actually effecting any change. It was about the performance. He reminds me of someone I used to know distantly at Queen’s who was infamous across several departments for the same sorts of things.

Similarly, at Mass last night, an old woman shouted something — no quote for you! — in response to a very unobjectionable comment by the priest during the homily. (That only God could judge the heart; the reading was the story of the woman taken in adultery: “Go and sin no more”.) Did she expect the priest to start a conversation with her in the middle of the service in an enormous cathedral with hundreds in attendance?

And on the way to the church, there was a guy on the Underground who thought that headphones were beneath him, and instead let his music blare out of the player so that we could all be entertained by it. And a fine choice it was too, with the shouting and bad guitar and the drum line which would have shamed the autoplay features on a twenty-dollar keyboard.

Today’s peeve: people who can’t respect social boundaries involving speech and noise. Thank Heaven we’ve finally invented blogs, so that everyone in the world can publish all of their silly thoughts to the rest of the human race, and none but the willing need read them.

twenty-five times twelve 24 March 2007

Posted by DSM in miscellanea.
comments closed

Then we will fight in the shade.

That is all.

some days you get the bear 21 March 2007

Posted by DSM in daily life.
comments closed

Yesterday turned out to be surprisingly productive: by the end of the day I was up by two thousand lines of code or so.

.. oh, all right, if you’re insisting on total disclosure. Admittedly some of that was duplicated code which I hope to get rid of eventually. Generally speaking, code duplication is just a subtle bug waiting to happen, but C’s a pretty weak language as far as inbuilt data structures and methods go.. and being both strongly- and statically-typed, it “sets” pretty quickly in the sense that it dries into something hard and difficult to modify. So if you’re practicing bottom-up development, there can be advantages to some short-term duplication when you haven’t figured out what the right level of abstraction is. I do hope to get rid of a lot of the code from yesterday soon enough, but for the moment it works nicely.

(How’s that? Too obvious for programmers and too vague for nonprogrammers. We’ve achieved zero-knowledge transfer, Doctor! Prepare to reverse the polarity of the neutron flow!)

Apart from my main multiscale code, I’ve also made progress on some other fronts. The regime of planet formation I study is known as “oligarchy”, where the system divides roughly into two: a small number of large protoplanetary embryos which control the dynamics, and a large number of much smaller rocky planetesimals in which the embryos are embedded. Think of a much denser asteroid belt (looking more like Saturn’s rings) with a bunch of large moons flying around.

This is understood reasonably well at low masses, which means that I can use semianalytic models to fast-forward through this early phase and start my numerical simulations much later when there are far fewer objects I need to track. In my thesis, I used a modified version of a model due to Ed Thommes, Martin’s grad student before me. More recently, John Chambers has developed a far more sophisticated model and I’ve been implementing it from his description in the paper.. unfortunately, there are a few missing pieces in his explanation which make it hard to know exactly what numbers he’s chosen to put in certain equations. It looks like I’m getting the shape of the curve right but there’s an offset, so it’s tough to know if there’s a problem or not.. I’ll have to compare with his previous papers.

I managed to get quite a lot of the Chambers model running yesterday, though, and I think that has a lot to do with the fact I wrote the Chambers code in python and not in C. I’m roughly a factor of five-to-ten more productive in python, although that’s a pretty handwavy comparison because there are problems which are trivial in python but would take forever to code in C, and so I’m not sure how long it would actually take..

I’m a big believer in the use of VHLL (very high level languages) for programming in general and scientific programming in particular. As a rule, if you find yourself needing to write in C or fortran it’s usually a sign you don’t understand your problem well enough, and you’re wasting large amounts of time you should be spending at the pub.

Like most rules, of course, this one has its exceptions.. such as high-performance computation where the task doesn’t break nicely into discrete compute chunks it’s easy to optimize. Computations dominated by FFTs or eigenvalue finding, for example, can often be handled nicely even in VHLLs because 99% of the time is spent in routines which can be pushed out of the interpreter into tuned low-level libraries, and your VHLL code is basically scripting. Computations where the work is more spread out, where you have to take a lot of loop steps, are far more challenging.

Guess which kind of simulations I do? :(

Just my luck to work in a subject (HPC studies of planet formation) where I have to break my own policies to accomplish things. I look forward to the day — when PyPy is complete, maybe? — when I’ll never have to write in as frustrating a language as C again. Maybe if CASCA ever lets me rant during the education section I can help save the next generation from the brainrot that use of C and fortran causes.

Preparations for tomorrow’s lecture continue, I decided that a crazy idea which has been lurking at the back of my mind for the last few years might actually work, and I’ve started on the enormous backlog of emails which somehow built up. Frankly I’m astonished anyone still bothers to write, but it’s appreciated!

return of the prodigal 19 March 2007

Posted by DSM in daily life.
comments closed

Rumours of my death have been greatly exaggerated.

(That’s one of my favourite lines ever.  I’ve considered spreading rumours of my death just to have a chance to use it.)

The last few weeks have been unexpectedly hectic, which explains the lack of posting.  Some stuff — like work — has been going very well.  Code is progressing nicely, new nodes have arrived for our simulations, etc, etc.  Other stuff — like, well, life — has been less enjoyable.

To give you a taste of the flavour: now that I’m no longer a student, it’s time to start repaying my student loans.  They don’t amount to much, and frankly I could pay them all down right now with what I have in the account.. but that would blow away my rainy-day fund (should I need to leave the country in a hurry and change my name to Miguel Sanchez).  And it rains a lot here..

Anyhow, the wonderful folks at CIBC drove me crazy.  They took to calling my parents, which I use as my secondary number because of its permanence, at 6:00 in the bloody morning to get them to get me to call.. even though I already had, and had cleared everything up.  When I called to complain, they had no record of the call!  I explained, patiently at first, and then less so, that since this was the number they’d left they should bloody well be able to explain to me why they called at six A.M.

Finally it turned out that they have a semi-automated “COURTESY CALL”, whose database wasn’t correctly getting the right information for some reason.  “You keep using this word.  I do not think it means what you think it means.”  But they thought they’d sorted things out. I was complaining about this whole saga to a friend of mine (the one who keeps losing his mittens) when I got an email from Mom saying that she had just had ANOTHER call, making six or seven in total.. so I called CIBC again to yell at them, determined that I wouldn’t get off the line until it was dealt with, whoever I had to speak to.

(While I was on hold, they played “Baby, it ain’t over till it’s over.”  That was not the appropriate lyric given the situation.  I’d quote the right one but this is a family-friendly blog.)

Finally it turned out that they wouldn’t let me speak directly with the guy in charge of calling me — I’m unimpressed by his cowardice even as I have to respect his instinct for self-preservation — but insisted that things were now fixed.  Why?  Well, because apparently now the calling dep’t had a note saying they’d contacted me.  Which of course they hadn’t done, even though they have my London number.

No, what had happened is that my easygoing mother had told them in no uncertain terms that they’d screwed up and apparently this was enough.  So I speak to them a half-dozen times and this is insufficient to get them to toggle the “spoken-to-Doug” flag in my file.  On the other hand, they speak to someone who isn’t me at an address I haven’t lived at in a decade and a half in another country, and that apparently counts as a successful contact.

There’s a reason I switched from CIBC all those years ago, and now I remember why.

(“So let me get this straight.  You’re calling my elderly parents at six o’clock in the morning every day despite the fact that I’ve contacted you many times and everything is fine with my file.  Moreover, you have no record of the calls, although you think it’s because I’m on an autocontact list and they’re screwing up the timeshift. You can’t stop the calls, because it’s not your department making them, and you can’t put me in contact with the people who are making the calls because you’re the only group authorized to speak with the public.  So pretty much you’re going to keep calling until you feel like not calling any more, and there’s nothing I can do short of having the phone company forbid calls from CIBC to that number to get you to stop.  This is insane.”

“I can see why you’re frustrated..”)

Why not just turn off the ringer before bedtime as an interim solution?

Well, that takes us to the second unfun saga of late, involving my father, who’s had several operations over the past few months.  When they did the second surgery to drain some fluid which had accumulated after the first surgery on his back, the doctors were astonished that he was still walking around: the pain should have completely incapacitated him.

Unfortunately, or maybe not, after decades of continual anguish his pain tolerance has reached inhuman levels.  This isn’t actually a superpower, but a superweakness, because it means that he doesn’t get the information from the fact that something hurts which you’d normally expect.  A few years ago, I broke a bone in my right finger during football practice — and went on to score a couple of touchdowns afterwards, I’ll have you know! — and didn’t think it was broken because it didn’t hurt much the next day, so it took a month or two before I bothered to go to the doctor.  This is pretty much what it’s like for Dad all the time.

Pain has its purpose: it’s a message.  By studying patients with Hansen’s disease (leprosy), it’s been established that much of the tissue damage isn’t directly due to the Hansen’s but due to the resulting insensitivity to pain, which means the patients are continually harming themselves unknowingly..  (See the work of Dr Paul Brand.  Or that recent House episode about the girl with a similar condition.)

Well, even Dad finally decided to check himself into the hospital, at which point the doctors decided to remove his gall bladder.  Remember that car accident I mentioned months back?  It might have ruptured it — or not, who knows, maybe it was more recent.  In any event they decided it had to go.

Or that’s what they thought.  It turned out when they opened him up that he didn’t have a gall bladder any more.  It had burst and gone completely septic and gangrenous.  Ordinarily that spreads and kills you, but his body had formed this strange cocoon to keep it isolated, and completely encased.  The doctors had never seen anything quite like it, although I gather that similar things are known to happen.  Not unheard of, just infrequent: the sort of thing you might bump into once in a career.  They had great difficulty believing that he wasn’t already dead, much less that he’d been up and about.

(My father, the zombie.  Huh.)

He’s now home, and recovering.  For many years I was convinced that he was just too stubborn-mean to die, whatever the laws of biology would say about it, but over the last few years he’s definitely been mellowing out.. which worries me.  If he’s lost his anger, he’s lost his fuel.

So if you’re reading this, Dad, go yell at the doctors for not catching the fact they were operating on a half-dead man over the last few surgeries or something.  We have a heritage to live up to: “conquer or die“.

On a happier note, my friend planetary atmospheres guy James Cho and his wife now have their first daughter.. and while he’s on leave I’m covering his lectures, which has also been a serious timesink.. especially because I don’t know as much ring dynamics as I ought to.  This week I’m covering planet formation, though, so that should go much better.

Anyway, in every direction there have been antiblogging distractions.  Fortunately things look to have settled down somewhat now, and I should return to my usual off-centre snarking.

I also have a confession to make, and no, it’s not that I broke my no-beer-during-Lent rule for St Patrick’s day, as tempting as that was.. but you’ll have to wait for that.

I’ll have the Ruby club 6 March 2007

Posted by DSM in Canada, television.
comments closed

I hope this is true.  Via Stephen Taylor:

I have it on good authority that the Prime Minister will be appearing on the season finale of CTV’s Corner Gas. The episode will air on March 12th.

For my non-Canadian friends, Corner Gas is the best television program — not counting Hockey Night in Canada, of course — that the True North has made in as long as I can remember, a series about life in small town Saskatchewan.  Slow-paced, good-natured, but entirely unsentimental, the mid-prairie attitude distilled to its essence and served with a double-double.

It tells you a lot about Canada that the last few leaders of a G8 nation which covers the second-largest area in the world have both wanted to appear on a simple comedy about the eccentric inhabitants of the fictional Dog River.

the next puzzle fad 5 March 2007

Posted by DSM in QOTD.
comments closed

After the distinguished speaker explained a particular construction for terraces (number sequences with particular properties) to the audience, and admired its simplicity:

“Yes. You can all make terraces. Why do sudoku?”

impermanence 5 March 2007

Posted by DSM in daily life.
comments closed

Two weeks or so ago, during a meeting with Richard, I moved to the whiteboard to sketch out a new scheme I had in mind.  As I was about to start writing, he stopped me by pointing out that the marker I was holding was black-coloured, which meant it was permanent.

Then I realized that the whole board was covered in green permanent marker, most of which was my fault.

There are lots of ways to get rid of permanent marker (and nonpermanent that was left too long) but the one I decided I liked best was simply writing over the stuff with nonpermanent marker.  It’s easy — it just dissolves away underneath it — but it doesn’t scale well.   If you write a word and then notice that you’ve used the wrong marker, it’s quick to use the right marker as an eraser.  However, cleaning an entire board with it is awfully inefficient..

So of course that’s what I did, because all the other methods involved shopping.  It probably took me three hours, all told: I’ve been doing it when I’m bored and I’ve just finished it.  Feel like I’ve actually accomplished something!

I think doing it the slow way was just an excuse to take breaks now and then from coding, and listen to K-Os’ last album, Atlantis: Hymns for Disco, which I liked.  Not quite as brilliant as Joyful Rebellion, but still excellent.

I can sense it already: it’s going to be another exciting Monday.  Today’s physics seminar is on complexity and criticality, and the pure math talk is on mutually orthogonal terraces, so at least I’ll have something to break up the tedium.

a time to kill 2 March 2007

Posted by DSM in miscellanea.
comments closed

From today’s Bleat:

Since we last met, Gnat gave her Peace Prize presentation. All the kids are giving presentations on the Peace Prize winners. Gnat got the Quakers. Great, I said. We’ll do a presentation on America’s most famous Quaker – Richard Milhous Nixon! But we ended up doing something about the historical roots of the Quakers, and Daddy kept all his cranky churlish commentary out of the subject. Not that I don’t respect the Quakers; I do, but I have problems with their philosophy. Non-violence is a wonderful ideal if the other side plays along – and yes, I know, you bring them around with your example, and eventually everyone is non-violent. Fine. But if there’s a school shooting, no one wants the authorities to send in the Quakers to set a good example.

This might have been a teachable moment, as they say – a chance to discuss the necessity of respecting people whose beliefs you regard as decent and humane, yet inconistent with your own understanding of the world. But we’ll save that for third grade.

As Lileks puts it, working through “the necessity of respecting people whose beliefs you regard as decent and humane, yet inconistent with your own understanding of the world” is a difficult but unavoidable challenge. Just like him to be so profound in a throwaway line.

Pacifism strikes me as an eschatological call, a counsel of perfection, and doesn’t work if generally followed: but just like monastic life, which would destroy the human race in a generation if everyone were called to it, I admire the purity of the sacrifice even as I worry about the dangers of immanentizing the eschaton. (Conservative in-joke there.) Pacifism has a problem that monastic life doesn’t, though: if a man doesn’t marry I don’t think he’s done anything wrong. However, I can’t help but believe that if a man saw terrible crimes before him which he could have prevented but chose not to because it would have required violence, the proper response afterwards is not to praise him for his peaceableness but to hang him for his moral disorder. A man can be too violent, but he can also be not violent enough.

As for the student presentations, I wonder if the teachers assigned anyone Arafat (murder; murder; promise to murder less, win the Nobel Peace Prize; repeat) or Jimmy Carter (as the Simpsons joke went, he’s History’s Greatest Monster: a joke which is increasingly less funny given his anti-Israel fanaticism.)

Probably not. One hopes they’re at least seventh-grade material.