mmcirvin


Matt McIrvin's Steam-Operated World of Yesteryear


Some Sage code about Fibonacci-like sequences and primality tests
mmcirvin
For a little while I've been poking around in some basic number theory using the Sage computer mathematics system (and a tiny bit of PARI/GP, which is another package that comes bundled inside of Sage).

I was initially inspired by a blog post of John Cook's about the Perrin numbers, a sequence sort of like the Fibonacci numbers that can be used via a simple further operation to generate what seems to be a list of prime numbers (and it in fact contains all the prime numbers, but eventually starts including some composite ones as well... starting with 271,441.)

More on sequences and pseudoprimes...Collapse )

The main purpose of this post is to provide all of my Sage code. So people not interested in that can stop reading here...Collapse )

Dental implant: DONE
mmcirvin
And now I have a tooth. A fake tooth. I've been eating with it and everything.

The last stages of this process were pretty simple and relatively unexciting to recount. A couple of weeks ago, I went in and my dentist checked the fit of the metal abutment that would run up the middle of the tooth; he stuck it into the hex-shaped socket and put in the screw, and they took an X-ray to make sure it was properly seated in there. Then they took it out again, and compared my real teeth with a color chart so they could get the crown to match.

Today, the ceramic crown was finished, and there was a little bit of testing it in place on the abutment and grinding it down to get the bite just right. Then the dentist used a tiny little torque wrench to get the screw holding down the abutment to some precisely measured degree of tightness (he said the torque wrench was a recent development in dental-implant practice), and glued the crown on top.

It's not precisely functionally identical to a real tooth. Real teeth sit in sockets and have a bit of freedom of motion; this thing's rigidly bolted to my jawbone, which is one of the things that sometimes makes implants fail in various ways. At least if it's the crown that fails instead of the bone, they can replace it pretty easily.

For now, though, it seems to be working.

Mathematical fumblings: the Klein j-invariant and near-integers
mmcirvin
On Google+: Why e^(pi * sqrt(163)) is almost, but not quite, an integer, and how it relates to a pretty function called the Klein j-invariant. With some pictures, and bonus references to Ozma of Oz and an April Fool prank by Martin Gardner.

I am a piker compared to oonh, and there's some handwaving in the math because I don't understand it all, but I had fun playing with this.

Free math
mmcirvin
Many years ago, when I was a grad student, I bought a student-discount copy of Mathematica, the symbolic computer algebra system. It was crucial to finishing my doctoral thesis: I pretty quickly got beyond the point where I could safely do the algebra involved in my research by hand without making a fatal mistake somewhere. I knew some people who had superhuman ability at manipulating page-long expressions without screwing up a minus sign, but I definitely couldn't.

Unfortunately, that old copy of Mathematica (for the Mac OS of the time) was soon orphaned by Apple's many major OS and hardware changes, and stopped working long ago. And Mathematica is a really expensive piece of software, especially if you're not buying the student edition. Even the stripped-down "Home Edition" costs hundreds of dollars! There are alternatives, but until recently, the most viable ones (Maple, Macsyma) were all costly commercial products too.

Wolfram improved matters greatly by providing a free public front end in Wolfram Alpha. It's very nice for the purposes that many people will need, especially since it has a pretty good natural-language interface that means you don't really have to learn any special syntax to enter a problem. But it's limited to simple question/answer interactions rather than extended multi-stage calculations, and they often pull advanced features back behind the paywall (they clearly want you to buy a subscription).

In the past few years there have been several efforts at coming up with free alternatives: there's a free fork off an old version of Macsyma (the granddaddy of them all) called Maxima, and a very cool Python library called SymPy that you can use either interactively or scriptedly from within plain old Python, and a number of more specialized projects aimed at specific branches of mathematics.

I've been playing around with Sage lately. It's an interesting system. More on Sage...Collapse )

(no subject)
mmcirvin
We managed to get back through Boston yesterday without significant incident, though the train was a little late and the traffic on I-93 was bad. I was going to bed around the time last night's craziness in Cambridge and Watertown was starting to break, so I missed most of it. I'm still on vacation, and I actually live quite far from Boston up near the NH border, but obviously we won't be going in toward the city today unless the situation resolves.

(no subject)
mmcirvin
We are in New York City for the week, so were nowhere near Boston during today's events. It remains to be seen how security and such will affect the rest of our trip and our return on Thursday, but I don't see a huge amount of panic here.


Posted via m.livejournal.com.


Goop and coping
mmcirvin
So on Thursday I had the second dental impression referred to in the previous entry. This was a little more involved than I expected.

The end result of the implant process has been that there's a convenient metal adapter in my jaw, with a threaded screw hole in the middle, but also, around that, a shallower hexagonal socket that the final abutment will key into so it doesn't turn. In order to make the abutment and crown align properly with my other teeth, the lab that will make them needs an extremely precise reading of the orientation of that hexagon.

The way they got that is kind of interesting. The rough impression I had a couple of weeks ago was just to make a custom tray for this second impression, which used a much more rigid-setting, extremely vile-tasting purple material. But before taking it, the dentist unscrewed the simple healing cap that's been hand-screwed into my implant and replaced it with something called an "impression coping". This was a piece of metal with a hexagonal base that keyed into the implant, and was held in with a separate screw sort of like the final abutment will be. But instead of the support for a crown, the top of it was a vertical post with two weird bow-tie-shaped projections sticking out to the sides. The central screw holding it in was a long thing that stuck out far enough that I couldn't bite down fully.

They put in the impression coping, took an X-ray to make sure it was securely seated in there, and poked a hole in the custom goop tray so that the screw could stick right out through it. Then my dentist jammed the tray down over that with the impression goop inside, told me to bite down on his fingers holding the tray in place, and stood there for five minutes humming along with the Sixties pop on the satellite radio and pretending not to be uncomfortable with me continuously biting him.

When the impression was almost fully set, he unscrewed the long screw, then lifted the tray of hardened material off my jaw so that the coping came right along with it, with the projections at the top stuck in the impression material. The end result was an inverse image of my lower jaw with the impression coping sticking out of it, its hexagonal base registering the angular position of the hexagonal socket in my jaw.

Anyway, I thought it was interesting. The healing cap's back in now; I think the next step is to CNC-mill the metal abutment, and my next visit is to check the fit of the abutment before the crown on top gets made.

Zeno's implant
mmcirvin
The closer I get to the end of my dental-implant process, the more steps appear. Now that the surgical part is over and the implant's in my jaw, the process gets handed back to my regular dentist to produce the final abutment and crown.

It turns out this is going to be four appointments, of which the first was yesterday. That was a quick visit to take a dental impression, which will be used to make a form-fitting goop tray to take another impression at higher resolution with a more rigid material.

They need a precise model so that they can make sure the abutment and crown are made right. Right now, I've got a temporary healing abutment that looks like a flathead screw, which is just hand-screwed into the threaded hole in my implant. But the implant also has some kind of shape around that to keep the final abutment from rotating. It's a titanium piece with a computer-rendered shape that they'll make on a CNC milling machine, which will key into the top of the implant in a fashion reminiscent of flatpack furniture, and be held in place with a screw through the middle. Then the tooth-shaped ceramic crown goes around that. I think the abutment gets tested for correct seating and orientation at the third appointment before they make the crown part.

It won't all be done until early May, and then I go back to the oral surgeon for one last follow-up check. Here's hoping it's all worth it.

Tooth implant update #4: abutment installed
mmcirvin
Today's procedure was a very short one, just ten or fifteen minutes of actual work. When I had the metal screw inserted into my jaw, the oral surgeon stitched up the gum tissue over the top of it again, so that I just had a toothless space in my gums there. Now that that's all healed up and the bone has presumably fused with the screw to some degree, the next step was to open up a small hole in the covering tissue, expose the smaller threaded socket inside that screw, and put in a "healing abutment", a smaller-diameter screw with a wide, flat conical head that sticks out on the surface.

Since the local anesthetic wore off, I've been a little sore, but it's nowhere near as bad as the previous installments that involved stitches; an Advil more or less takes care of it.

The purpose of this is, I think, to let the gum tissue re-heal into more or less the configuration it will need when the crown goes on in place of the abutment, which is something my dentist will do in a few weeks.

I'm not sure whether that will be a single- or multiple-stage process of its own. But then I've got a final appointment with the oral surgeon in May to check if everything came out OK. At any rate, my new tooth isn't that far off any more. But now I look like I've got a flathead machine screw where a tooth is supposed to be.

They Might Be Giants, Nanobots
mmcirvin
I got They Might Be Giants' new album this morning and have listened through a couple of times. At times it seems almost like a retrospective of TMBG's many familiar styles and gimmicks: the first song, "You're On Fire," is almost a sequel to "You Probably Get That A Lot" from Join Us; later there's a political song from Flans ("Black Ops"), a wistful biographical song about a historical figure ("Tesla"), a cluster of "Fingertips"-like mini-tracks about halfway through (with a few others scattered throughout), even a song about a young nerd with a goofily portentous spoken-word bridge straight out of the Pink Album ("Circular Karate Chop"). It's fair to say they're not going out of their way to shock the fans with this stuff.

That said, John Linnell breaks some new ground here that I personally greatly enjoy: having become a master of children's music, he's starting to sing in his wry fashion about the adult experience of being a parent. "Nanobots" and "Replicant" both frame the experience in pseudo-science-fictional terms; the title track in particular is an utterly joyous piece of work that I want to listen to over and over, whereas the other suggests some of the darker possibilities.

On the flip side of parenthood, "Call You Mom" is a hilarious song about a person with serious, serious relationship issues, which is musically sort of like "Yakety Yak" collided with the Peter Gunn theme.

Flansburgh also gets a little off the beaten path with the spooky, jazzy and baffling "The Darlings of Lumberland" and the melancholy "Sometimes A Lonely Way", which I haven't quite entirely processed yet.