Monthly Archives: September 2006

Trigonometry and Making Stuff

I must admit: I’m a bit of a math nut. Solving interesting mathematical problems makes me feel cool. But I must admit that I’ve suspected for a long time that one branch of mathematics is almost completely useless, and that’s trigonometry.

By way of evidence, witness the following link:

Per Vivere [To Live]: Trigonometry and Making Stuff

It’s very nearly the perfect example of why trigonmetry is useless. Witness the six stage derivation, which includes no less than 12 trigonometric functions, before arriving at the final answer, that the angle required is 16.26°. Then, at the end of it all, what does he do? He needs to set his protractor, which he doesn’t trust, so he computes the tangent of 16.26°, multiplies it by a baseline of 300mm, and arrives at 87.498837mm.

But what do you do if you don’t have a scientific calculator? Or even a protractor? If you look at the problem, you can easily reduce it to a simple application of the Pythagorean theorem (you all remember, the a2 + b2 = c2 thing?). From his drawing, it is apparent that the block that you want to cut has a hypoteneuse of 125, and has one leg with length 35. That means that the other leg is the sqrt(1252-352), or 120mm. To set his angle gauge over a 300mm distance, (2.5 times the baseline he actually has), he needs to multiply the thickness of his piece by the same amount, and arrives at the precise answer: 87.5mm.

Sines, cosines and tangents all arise from the properties of right triangles. In virtually every case, it is simpler to draw a diagram and work out the resulting lengths via the Pythagorean theorem. The only time you need to remember what a sine, cosine or tangent is are in those rare situations where you actually need to know what an angle actually is, and even then, it’s best to just do that conversion from two appropriate lengths at the end of your problem.

Of course carpenter’s have known this for a long time, that’s why you don’t see any degree measures on a framing square, although their use is fading into the past as well. Too bad.

[tags]Mathematics[/tags]

Addendum: Wikipedia has a brief introduction to the use of the steel square.

Crazy Baseball: San Diego Padres/Los Angeles Dodgers Box Score Monday September 18, 2006

I normally only closely follow the Oakland Athletics on a day to day basis, and sometimes try to see what else is going on in the American League. But as I have often said, the cool thing about baseball is that you never know what you are gonna see when you come to the ball park. And Monday’s Dodger/Padres game was no exception. The Padres were leading 9-5 when the Dodgers came to bat in the bottom of the 9th. The result? Back-to-back-to-BACK-TO-BACK home runs to tie the game. Kent, Drew, Martin and Anderson all homered. The Padres would score in the top of the 10th, but in the bottom of the 10th Garciaparra would hit a walk off two run homerun to put the Dodgers on top for good.

You never know what you are gonna see when you come to the ballpark.

[tags]Baseball[/tags]

PeakStream, plus a story

This begins as a product announcement, but is really just a clumsy way of introducing a story.

Flipping through my usual news sources, I’ve seen a couple articles about PeakStream, a company which has a set of software products for creation of high performance code for GPUS. Normally, such a thing would be of mild interest to me, but as I read some more, I realized that one of the brains behind the company is Stanford professor Pat Hanrahan, a name which is familiar to most in the computer graphics industry, and a name which has played a role in my own career.

Back in 1989 I had just graduated with a Masters in Computer Science from the University of Oregon. I had gone on a number of interviews without much success, but then flew to New Jersey to interview for a position in scientific visualization at the Department of Applied Mathematics at Princeton. Over the next year and a half, I helped a number of their staff to create animated visualizations of fluid flow simulations (a topic which, admittedly, I know very little about even now), mostly by writing simple renderers to display particle and flow line data, and such mundane tasks as writing control software for Lyon Lamb controllers for video controllers and dubbing video tapes.

But somewhat coincidently, I had arrived at the time that Pat Hanrahan had signed on to create a computer graphics lab at Princeton. I remember our first meeting at P J’s Pancakes in Princeton, where we discovered that we had a number of interests in common. Over the period of a few months, I’d drop in on him and have a peek into what he was doing, and sat in on some of his undergraduate lectures, where I must admit that I learned quite a bit: after all, I was almost entirely self-taught in computer graphics, and let’s face it, it is hard to spot your weaknesses when you have only yourself to rely on.

The thing that amazed me most about Pat was his amazing breadth of knowledge, and the seemingly effortless way that he unified seemingly widely different disciplines and created new ideas from the result. The most memorable of these was on the day that I walked into his office and he demonstrated his first program that did rapid hierarchical radiosity. He had a cube environment with a triangle blocker on the screen, clicked a button, and within a second, a complete radiosity solution was calculated on what was probably an SGI 4D25 or so. I was amazed. What was even more amazing was his explanation. A half an hour later, as he explained how it was related to n-body simulation (a subject with which I was not completely unfamiliar) and how these systems resulted in block structured matrices that could be efficiently solved, I was blown away.

As I recall, that was one of probably five or six papers he was working on at the time.

I consider him to be certainly one of if not the smartest guys I’ve ever met.

By the time 1991 rolled around, I had tired of feeding VCRs and was seeking new employment. Due in some measure to the strength of Pat’s recommendation, I secured an interview and later a job at Pixar. And, the rest, they say, is history.

Why Programming is Hard…

If you get a degree in computer science, you end up taking classes on the theory of computation. Here you learn about something called a Turing Machine: an abstract computer that is very simple, yet can be shown to be able to compute anything that any other computer can compute. The Turing machine consists of:

  • a TAPE which is divided into cells, each one of which can contain a character. For the sake of this argument, we’ll assume that each cell can either hold a one or a zero, but no other values. The tape is best visualized as doubly infinite, stretching off to infinity in both directions around the start position. For the sake of this discussion, we’ll assume that the tape is initialized to all zeros.
  • a HEAD which can read or write symbols on the tape. At any given time it is positioned over a cell, and can move either one step to the left or the right.
  • a TABLE, which governs the actions of the Turing machine. This table is a mapping which takes as inputs the state of the machine (hold on, we’ll get to that) and the character under the read head, and tells you:
    • what symbol to write at the current location
    • whether to move the head left or right, and
    • which state to change to. If the new state is a special HALT state, then the machine stops, and the computation is over.

    The state table is read only, and fixed in size.

  • a STATE REGISTER, which holds the current state

And that’s all there is to it. With a little work, you can figure out how to do anything that you might consider comptutation on such a machine: there simply doesn’t appear to be any feature you can add to such a machine to actually increase its ability to compute stuff. This would be not too interesting, except that there are things which cannot be computed by such a machine, and by extension any other machine. It turns out that one of the simplest questions that cannot be answered is whether a given program will arrive in the halting state, the so-called “halting” problem.

Another somewhat interesting question is “what is the maximum number of ones that a Turing Machine with n states and which halts can write on an initially blank tape?” This is the so-called Busy Beaver problem, and it too is uncomputable. For certain small values of n we can exhaustively analyze all possible Turing machines, and we find that a 2 state Turing Machine over the binary alphabet can write 4 ones, a 3 state machine 6 ones, and a 4 state machine can write 13 ones. The reader might try to hypothesize a guess as to what the maximum number of ones written by a 5 state machine might be. Then, consider a six state machine.

The best known 5 state machine writes 4098 ones, and is not known to be the maximal. There exist a 6 state machine that writes over 1.2 x 10865 ones.

For fun, I dug out the best known 5 state machine, and wrote a little .signature program version of it, which I include below. It runs for 47,176,870 cycles and writes 4098 ones before halting. If you’d like to learn more, surf to the links above, and check out Heiner Marxen’s page for more information.

int S[5][2][3]={1,0,1,1,2,2,1,0,2,1,0,1,1,0,3,0,2,4,1,2,0,1,2,3,1,0,-1,0,2,0},
tp[20000],*T=tp+99,*q,P,c,s,o;main(){for(;s>=0;c++)o+=*(q=S[s][T[P]])-T[P],T[P
--]=*q++,P+=*q++,s=*q;printf("%d steps %d ones\\n",c,o);} /* markv@xxxxx.xxx */

[tags]Computer Science,Theory of Computation,Turing Machine[/tags]

Bits on Pickles & Cucumbers…

I wrote a long rant about Scoble’s latest whine, but when I proofread it, I couldn’t imagine that anyone cares. Shortly after, I had a phonecall from my mom, and like we do when we don’t have much to talk about, we ended up talking about recipes. Apparently my sister had been making some pickles, and we ended up talking about them.

Pickles aren’t a very glamourous food. The seem kind of yesterday, don’t they? The kind of thing that your grandma might place out during Thanksgiving meals, but you don’t really think about them much probably. There is probably a fairly good reason for that: most pickles you buy in the store simply suck. They have an overcooked, oversalted, oversweet (if sweet) or rancid (dill) flavor that just isn’t very pleasant.

But I have memories of different pickles than that. In particular the garlic kosher dill pickles and the “bread and butter” pickles that my grandma used to lay down. I haven’t tread into the kosher dill arena yet, but I have made entirely delicious bread and butter pickles, which are simple and can be done in small batches whenever you want ’em. Even if you aren’t a pickle fan, try dicing some of these into a tuna fish salad sometime, and you will turn up your nose at your standard supermarket variety.

I don’t have grandma’s recipe, but I tried Alton Brown’s B & B recipe, and they are dead easy to make, require no special techniques or equipment, and are just darned yummy.

The folks in the Mediterrainian have a different spin on the cucumber, often combing it with garlic, olive oil and yogurt. I didn’t know what they called it (tsasiki) but no matter how you spell it, with a combination of ingredients like that, it just can’t be bad. In a strange harmony of coincidence, Cooking for Engineers had a nice recipe (again, the kind of thing that your grandma would cook for you).

Cooking For Engineers – Recipe File: Anghelika’s Tsatsiki (Tzatziki)

Other ways I like cucumbers? How ’bout with some sprouts (or maybe watercress) and some cream cheese on a sandwich with a glass of ice tea on a hot summer day? Or in a spicy gazpacho? My grandma (and mom) make a salad by brining onions and cucumbers overnight, then draining and rinsing them, and making a dressing from mayo and a little vinegar. Brining them overnight removes some of the bitterness, and I really like the creamy onion/cucumber combo. Instead of mayo, you could probably use yogurt. Maybe with some fresh dill, that would be tasty.

I’m gonna add some ingredients to my shopping list for the farmer’s market this weekend.

[tags]Pickles,Cucumbers,Food,Recipes[/tags]

Live at Nintendo’s NYC Wii press conference

As someone might know, I’m a big fan of Nintendo. I never had the old NES, but I’ve had at least one of every game system Nintendo has shipped since then, and really like a lot of their games. It is with some interest then that I am watching the developments surrounding the Wii: Nintendo’s next generation console. For one thing, it was rumored that they would ship it at a pricepoint signficantly lower than the Xbox 360 or the planned price for the PS-3. I think it is important for game manufacturers to remember that they are making game machines. The enjoyment you get out of a game is to some degree correlated to the number of pixels you see on the screen, but only loosely. Nintendo seems to see that. Instead of bragging about how fast their processor is, they are talking about their release titles. Instead of telling you how big their hard drive is, or how many pixels it can draw, they are demoing a new, innovative controller. Oh, and it will come out at a far more reasonable $250 price point (I was hoping for $199, but you can’t always get everything you want). Still, you get a nifty game console for what the PSP costs. Neat.

Anyway, Engadget has coverage of their press conference this morning. They release on Nov. 19. They expect to ship sell four million units before the end of the year. That’s a billion dollars worth of product. Zelda will be available at launch (and consequently, will be my Christmas present from my wife, assuming I can wait that long). They seem to have the Internet/Wifi/broadband in mind, with Wii Channels to allow their users to interact, and even buy copies of old legacy games for reasonable prices ($5 for old NES games, $8 for NES games). Seems to use SD cards for storage (which I think is an excellent move, I think rotating storage for a game machine has become silly with dropping flash prices). No subscription costs for Nintendo Internet services. They support widescreen on all their first party apps.

Read more from Engadget: Live at Nintendo’s NYC Wii press conference – Engadget

[tags]Nintendo,Nintendo Wii,Video Games[/tags]

How Movie Theaters Might Thrive in an On-Demand, Long Tail World

It’s been a while since I checked in on Amy Gahran’s blog, but today I’m glad I did, because she has a thought provoking idea:

Contentious » How Movie Theaters Might Thrive in an On-Demand, Long Tail World

The idea? Movie theaters market directly to consumers, allowing them to rent movie theaters and have screenings for small-to-large groups instead of showing the weekend Hollywood block-buster du jour. I think it’s a great idea, and one that will become more tractable in the coming future of digital projection.

The comments also include comments by the founder of bravenewtheaters.com, a group which isn’t waiting for big mainstream theaters to hop on this particular bandwagon. More good stuff.

You think I am hard on Microsoft?

Checkout some of the keywords from this article on the Guardian.

“…elephantine parturition… Security vulerabilities come free with all version. … interminable corporate nightmare. … only a shadow of what it was envisaged… engineers were trudging through their death march….

Ouch.

Ultimately the article makes the (IMO entirely correct) point that the future lies in virtualization. Ultimately, you won’t have to decide which operating system to run. You can run them all, each nicely partitioned off into a virtual area. Companies like Microsoft which rely on customer lock-in will find their hold slipping as the annoyance of trying new systems and new ways of working are continuously reduced. It’s hard to keep the boys on the farm once they’ve seen the big city.

New PSP Game: Locoroco

Carmen bought me a new game for my PSP today: Locoroco

I must admit, despite the fact that PSP hardware rocks all over the DS hardware, I spend way more time playing with my Nintendo DS than I do with the PSP. The simple fact is that there are more games I feel like playing on the DS than on the PSP. Mario Kart. Metroid Prime. Mario & Luigi, Partners in Time. Princess Peach. Starfox DS.

The only games that I really liked for the PSP was Me and My Katamari, which had the quirky gameplay that made me really like the PS2 version. So, it was with some trepidation that Carmen decided to give me Locoroco.

And, it’s very good.

The basic premise: you are a little blobby thing. When you eat orange fruity things, you clone. You can merge your clones into a big ball, or you can break yourself up into individual little guys. You try to navigate a world, and make as many clones of yourself as you can. The controls are very, very simple. You hit the L button to rotate the world left. You hit the R button to rotate the world right. You hit both of them to jump. The circle button either breaks you apart, or joins you back together. That’s it.

Unlike previous games which literally crippled my hands, this one was quite fun and relaxing, and after a couple of hours dorking around with it, I still can type. It’s a very “zen” sort of game. It’s hard to totally die, but it is also hard to maximize your points in a given level. While some of the levels seem a bit repetitive, overall, it is really quite fun. I suspect it will mean that I’ll get a bit more use out of my PSP over the next few weeks.

It’s also got a nice screencapture facility, so here are a couple of random screengrabs from the game in progress.

Locoroco Gameplay
Locoroco Gameplay

If you’re into kind of cutesy games with novel gameplay, cute graphics, and infectious theme music, consider picking this one up.

[tags]PSP,Game Review,Locoroco[/tags]

Addendum: Videocrab has some of the music from Locoroco as an mp3 download. I was hoping that the Sony website would have these available for download, but apparently you need Flash to work to do anything useful on their website. Sigh.

Quickest Patch Ever

While I’m still in a rant mode, try looking at Bruce Schneier’s latest column on Wired:

Wired News: Quickest Patch Ever

Now, this isn’t a “vulnerability” in the normal sense of the word: digital rights management is not a feature that users want. Being able to remove copy protection is a good thing for some users, and completely irrelevant for everyone else. No user is ever going to say: “Oh no. I can now play the music I bought for my PC on my Mac. I must install a patch so I can’t do that anymore.”

But to Microsoft, this vulnerability is a big deal. It affects the company’s relationship with major record labels. It affects the company’s product offerings. It affects the company’s bottom line. Fixing this “vulnerability” is in the company’s best interest; never mind the customer.

Are you listening Microsoft? If you are going to gain a reputation for good customer oriented products, how ’bout creating products that actually solve the problems that customers have, rather than dedicating your energy towards satisfying your corporate partners?

[tags]Rants and Raves,Microsoft[/tags]

The word I don’t want to read in blogs anymore…

The word is: conversation.

What’s wrong with that rather innocent word? Scoble and his commenters seem to love it. The topic under consideration is the ongoing privacy scandal at HP, where chairwoman Patricia Dunn apparently authorized the highly unethical and possibly illegal practice of pretexting to determine which board members were leaking information to the press.

From the comments…

The best thing you could be doing with this woman is having a CONVERSATION with her, finding out why she did what she did and whether she would do things differently in the light of the repercussions.

I disagree. I think the best thing you could be doing with this woman is to fire her and let the attorney general decide if criminal charges should be brought against her. No conversation is necessary. What could she possibly have to say to justify such a gross ethical violation?

Look, we aren’t going to have “conversations” with companies. They are publicly traded entities, and their responsibility is to their stockholders. Their stockholders are happy when they maximize their profits, which means that they charge their customers as much as they can while delivering as little as they can. When that forms the basis of your relationship, just what kind of “conversation” do you think you are going to have?

From the previous day…:

Yes the news does seem to be getting worse, and yes it is a PR nightmare, and yes, if HP had established a stronger voice on the net then it might be having a two way conversation now instead of getting unilaterally bludgeoned.

There is only one thing that could have prevented HP from getting unilaterally bludgeoned: they shouldn’t have committed such a gross ethical violation. Once they did that, no conversation is going to patch it over. There is no explanation for hiring private investigators to misrepresent their identity to obtain phone records that they are not privileged to see. HP can’t have a meaningful conversation about that. They can either admit what they did and take appropriate steps to fix the issue, or they can ignore it and hope that it all blows away. But “conversation” simply isn’t meaningful.