I have left Harvard as of July 1, 2008 to take a position at NYU. This website has been cached and left static. Feel free to browse my new website, aka "What the heck is a Clinical Associate Professor?"

12.06.05

Is Numb3rs for real? Kinda!

Posted in Math, FAQ at 7:55 am by leingang

I often get asked if math is like how it’s depicted in popular culture. The answer is usually no. For example, in Good Will Hunting, Matt Damon’s advisor has a lush office ensconced in wood and leather and complete with a fireplace. I’ve never seen any professor’s office have such an office, at least on this continent.

But an exception to that rule is Numb3rs, which strikes me as being a surprisingly accurate portrayal of a mathematician’s life. OK, we don’t all use math to solve crimes, and there was this ridiculous scene in which the mathematician covers the inside of a barn with chalkboards to work on a problem. But at least the problem (the famous P vs. NP question) was a real one.

The show uses a team of mathematicians from Caltech (see “They’re calculatingly cool“, by Elizabeth Weise, USA Today, 2005-02-08) as consultants, and they’ve gotten it right. Not only is the mathematics discussed pretty real. The mathematician character isn’t some stuffy professor with leather patches on his elbows. He prefers T-shirts and jeans to sportcoats, he uses aloofness to cover his shyness, and he’s only passionate about solving problems. This profile describes more mathematicians I know than Matt Damon or Russell Crowe does.

Even the guy’s office is true-to-life. Nothing posh; just a pretty bare room with linoleum tile, an uncurtained window, a radiator, a desk littered with paper, and a chalkboard. This conjures up to me images of just about every graduate student office at MIT (except they are larger and are shared by several students per office).

To other mathematicians, I say the question is not so much whether this portrayal is accurate. There is a show on network prime time about math! I’ve heard CSI is not necessarily an accurate portrayal of crime-scene detection, but if gets young people interested in science, who cares? From the USA Today article: “If just one 14-year-old realizes that following a love for mathematics can lead to totally cool, intellectually fascinating work, [Caltech math department head Gary] Lordon says he’ll be pleased. ‘Even the smartest kids ask, “But what do you do?” ‘

Math is HOT! says your teacher

Posted in Math, Funny at 7:02 am by leingang

I found this advertisement for a math course on a high school web site.

Math is HOT! One of the most popular movies of 1998, Good Will Hunting, was a story about a math nerd who solves the problem and gets the girl. Wall Street relies on complicated formulas from calculus to predict trends and forecast the likelihood of financial success based on many factors. Books about mathematics and numbers are flying off the shelves at bookstores across the country. A major fragrance manufacturer is busy developing a fragrance for men called “\pi.” What could explain this mysterious phenomenon? According to National Public Radio, smart is in and so is the study of mathematics.

I love the sentiment, but may I satirically point out:

  • One of the most popular movies of 2001 was A Beautiful Mind, a true story about a brilliant mathematician who goes insane.
  • Let’s not forget the other math movie of 1998, \pi, in which [spoiler alert] a mathematician drills a hole in his head.
  • I don’t know if NPR is anybody’s arbiter of cool.

One of the things I love about mathematics is its versatility. The invention of calculus was part of the movement that split science from philosophy and made the world something that could be described effectively. With mathematics we have a language that applies to physics, chemistry, biology, economics, psychology, any science, even those which haven’t been discovered yet.

And yes, you can be a mathematician and get the girl.

12.05.05

Review of “No Nonsense XML Web Development with PHP” by Tom Myer

Posted in Books, PHP at 7:36 am by leingang

XML is, depending on who you ask, “One file format to rule them all”
or “most hyped technology” ever. One way to describe it is a
self-documenting file format with a simple syntax inspired by HTML.
But what is it good for?

What isn’t it good for? Anything can be stored in an XML format,
whether it’s web site content, data from an experiment, server logs,
whatever. Word processor and spreadsheet files saved by OpenOffice
are gzipped XML documents. XML can even be used to prescribe how one
XML document should be transformed into another, giving a nice
cross-platform method for (say) converting an OpenOffice file to HTML.
This is XSLT. With a few shell scripts and utilities, an entire web
site can be managed, publishing content in different formats, without
a full-featured scripting language.

But the base XSLT can’t do everything (for instance, insert the
current date), and so it’s nice to have the support of a scripting
language like PHP. PHP has its fans and haters, but its popularity
cannot be denied. It has a simple syntax and data model (in
particular, hashes and lists can be treated pretty equally), it’s easy
to learn, and it has tons of libraries built in, or able to be added.

Combining the strength of XML with the simplicity of PHP, here comes
the aptly-titled No Nonsense XML Web Development
With PHP
. The book is by Thomas Myer and is published by the good
folks at SitePoint (The book is generally not available in stores,
but can be purchased through their website). The author aims to
introduce the power and versatility of XML to the beginning web
professional. It’s a fun read, and although the average übergeek
may not learn much from it, it’s certainly worth recommending to a
newbie.

Read the rest of this entry »

12.01.05

Convert (La)TeX code to ASCII for Entourage

Posted in Computing, LaTeX at 8:47 am by leingang

I’ve rediscovered (after having forgotten its name) tex2mail, a nifty perl script that converts equations written in TeX or LaTeX to ASCII art. It’s not beautiful, but it works and is especially useful when discussing math over e-mail. On the Mac, you can use a cheap AppleScript to grab a selection and pipe it through this script, and you’ve got ASCII equations in your fancy mail user agent.

For instance, the LaTeX code


\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}

which would be written in a real mathematics document as $\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}$, becomes after tex2mail

                                            2
                             ~~   oo1   pi
                              >     -- = ----
                             /__ i=1 2    6
                                    n

Okay, so that’s not perfect, but it’s 90% there; you can clean it up if you want.

Once you’ve downloaded the perl script, put it in some directory where you keep scripts (~/bin or ~/Library/Scripts, perhaps), then create an AppleScript like this:

tell application "Microsoft Entourage"
     set theText to the selection
     if the class of theText is not Unicode text then
          error "Please select some text before running this script."
          quit
     end if
     set scriptName to "/your/path/to/tex2mail.pl"
     set replacementText to do shell script "echo '" & theText & "' | " & scriptName
     set the selection to replacementText
end tell

(I am a wordpress newbie so I don’t know why all my quote characters got escaped there. They shouldn’t be in your script. Alternatively, you can download the script.)

You can save this script in a directory that your mail user agent looks in for scripts. For instance, with Microsoft Entourage, the directory is “<your Home Directory>:Documents:Microsoft User Data:Entourage Script Menu Items” (unless you’ve changed the Microsoft User Data folder name somewhere in your Office preferences). Now in Entourage you can select some text, then choose your script from the menu that has the script icon. Hey presto! Cruddy ASCII equations.