Archive for January, 2005

Circuit Macros helper script

Monday, January 31st, 2005

For some reason or another, I’m always installing the Circuit Macros package by Dwight Aplevich. The part that always takes the most time is going through and changing the definition for HOMELIB_ in each of the m4 files. So here’s a little script that does that for you automagically.

[perl]
#!/usr/bin/perl

# The directory that CircuitMacros was unzipped into (with trailing /)
$cdir = $ARGV[0];

# The directory that changed files should be sent to (with trailing /)
$outdir = $ARGV[1];

@m4files = < $cdir*.m4 >;

foreach $file (@m4files) {
$sanitizedfile = $file;
$sanitizedfile =~ s/$cdir//;
$cmd = ” sed ’s/\/u\/aplevich\/lib\//\/home\/wherever\/libs\//’ $file > $outdir$sanitizedfile”;
print “$cmd \n”;
system($cmd);
}
[/perl]

Java Web Start

Sunday, January 30th, 2005

I’ve been reading about Java Web Start and the Java Network Launching Protocol (JNLP) API. It sounds very spiffy: you package up your application in a jar file (which of themselves are quite spiffy), along with all the various resources required, configure your server to handle a new MIME type for .jnlp types so browsers will know to open the file through Java Web Start, write a simple XML file to describe the packaged application, and make the jars and jnlp file available. Then the user can click on a regular link to the jnlp file and run the application from her computer; JNLP allows the author to specify whether the app can also be run offline; if so, then the user can run it from her desktop after downloading it once— the jars and resources are auto-cached. JNLP also supports automagic updating, by checking the application’s distribution point for a new version.

I think this brings the promise of Java as a universal platform that much closer. Now it seems possible to distribute and maintain nontrivial applications easily over the web. What would be truly awesome is a system with Java support built directly into the CPU, with a high bandwidth connection, along with Java implementations of OSes and major applications. But that’s just a dream for now.

Until then, I’ll settle for the reality of JNLP, and try to find uses for it.

Math skills vs. programming skills

Tuesday, January 25th, 2005

For the first time in a while, K5 has an interesting article on the front-page, one about mathematic puzzles, none the less. Considering the usual sparsity of anything but pseudo-science and political op-eds, this is a welcome change; makes me remember the things I used to like about K5.

The problems are pretty interesting, but what is even more interesting are the responses of readers. There are a lot of programs that ‘lazy coders’ said can ’solve’ the problems. What’s interesting about that is that I’ve noticed when I ask people who have any programming skills a hard math problem that involves counting or enumeration, they tend to display the mindset that if a problem requires a little thought, then you should probably relegate it to a task for the computer. I do that myself, to be honest. But avoiding developing or exercising the usually basic skills required to solve teasers like these is probably not a good habit to get into. The tendency to substitute programming for thinking reminds me of the comparison Gian Carlo Rota (?) makes between math and computer science: computer science as brute force mining for diamonds, while math as polishing those diamonds. I think the way he intended that comparison to be taken is that CS could be a tool useful for discovering useful patterns out of a mass of data, and then math used to develop and explain those patterns. I wonder if that is the way that any actual mathematicians work.

TeX support added to Commenting

Sunday, January 23rd, 2005

Since a lot of comments are about math, I enabled the LaTeXRender plugin for the commenting system (by adding the line add_filter('comment_text', 'latexcontent') to the latexrender-plugin.php file after the other filters). So now when you’re entering math, if you know LaTeX, you can use it by enclosing the code in [tex] and [/tex] delimiters.

Meta Category setup

Sunday, January 23rd, 2005

I’ve never really seen the point of a meta category, as I’ve seen them on other people’s sites, but after having gone through several generations of the software and services used to host the blog, all with varying capabilities, I see the light. Around the end of last year, the start of this one, I was manually entering all of my previous entries into the blog, because my previous web service providers cut off my access to MT before I could export the entries, so I only had access to a full archive of the website, and had to use the archived HTML entries. That was a real pain, especially because I had to decide what to do with the entries that had more to do with the blog’s internals and plugins being installed, etc., than with anything else. After all, now that I’m not using MT, who cares that the MTPerlScript plugin was tested sometime in 2002? Unfortunately, I didn’t take the time to make a reasoned deduction on what course to follow. The idea that a meta category might be useful, in fact, didn’t occur until just now, when I realized that I wanted to let everyone know that LaTeXRender is now enabled for commenting, but didn’t want to pollute the platform independence of the blog by posting it even in the General Category. Now whenever I want to move the entries between platforms, I’ll only have to check the meta category entries for relevance. Sometimes I can be very slow to conclude the obvious.

Binet’s Formula

Saturday, January 22nd, 2005

I’ve been working through proving some identities for the Fibonacci numbers, all of which have so far been provable using induction:

  1. f_0 + f_1 + \ldots + f_{n-1} = f_{n+1} - 1 for n \geq 1
  2. f_0 + f_2 + \ldots + f_{2n} = f_{2n+1} for n \geq 0
  3. f_1 + f_3 + \ldots + f_{2n-1} = f_{2n} - 1 for n \geq 1
  4. for n \geq 1, the successive Fibonacci numbers f_n and f_{n+1} are co-prime.
  5. f_{n+m} = f_{n-1}f_{m-1} + f_n f_m for n,m\geq 1
  6. if m | n, then f_{m-1} | f_{n-1}
  7. f_{n+1} f_{n-1} - f_n^2 = (-1)^{n+1}

However, I’m stuck on proving Binet’s formula,

 \displaystyle f_n = \frac{1}{\sqrt{5}} \left[ \left(\frac{1+\sqrt{5}}{2}\right)^{n+1} - \left(\frac{1-\sqrt{5}}{2}\right)^{n+1} \right],

I’m pretty sure this isn’t easily provable by induction, but it probably can be proven more easily than from scratch by using the identities above. I’ve seen it done before, e.g. in TAOCP, but I don’t remember how it was done. Besides, that would be cheating.

an ‘official’ Putnam sample problem

Friday, January 21st, 2005

It’s interesting to consider how I once disdained Putnam and other mathematics competitions, considered them to be pointless (since they don’t teach theory so much as a collection of cool tricks) and distracting. But since I heard about the Putnam (particularly the benefits associated with scoring well on it), and started trying to prepare for it early last year, I’ve realized that I was completely wrong. In fact, I wish I had known about and participated in high school mathematics competitions, because I feel I’m way behind in my collection of cool tricks. Some of these cool tricks turn out to be quite useful, even if not directly; furthermore, the practice in problem-solving and figuring out how to reach a difficult goal without being told (e.g. in class you are told what technique to use to solve a given problem, either directly in a form of a hint in a textbook, or just by the fact that you know what you were learning before the problem was assigned) is something that I think anyone who seriously wants to pursue a higher degree in mathematics should have. After all, what’s the point of understanding other people’s work, if once you’ve reached the edge of the known you can’t chart your way? Putnam and these other competitions teach you how to make your own cool tricks.

For that reason, I’m stoked about promoting high school mathematics competitions here in Houston. So far, I’ve volunteered with UH’s math club, UHME, to help out with the mathematics competition that UH hosts. I’d also like to do more; the high school I attended, for instance, attracts students who are interested in technical subjects, and the students are pretty bright, (it’s an engineering magnet school), so I’d like to pitch the idea of math competitions to them. I recall the only ones we had were the Texas Surveyor’s surveying competition, which was all trig, and pretty easy, GTAME, or something like that, which I couldn’t participate in, since it was on Saturday, and the NSBE Trimathalon, an intermural timed group math competition held at the NSBE junior conference conventions, which I competed in and loved. I’m sure there’s more out there for students to get involved in, and I would love to be instrumental is converting some future engineers into future mathematics :). At the least, I would like to heighten the sophistication of the problems that students are exposed to at the high school level: I think I could have handled it at that stage, and it would have done me much good.

Anyhow, I was looking for the solution to the Putnam problem I had posted earlier about finding triplets of sets, and saw this problem on the Putnam competition homepage:

Players 1, 2, 3, …, n are seated around a table and each has a single penny. Player 1 passes a penny to Player 2, who then passes two pennies to Player 3. Player 3 then passes one penny to Player 4, who passes two pennies to Player 5, and so on, players alternately passing one penny or two to the next player who still has some pennies. A player who runs out of pennies drops out of the game and leaves the table. Find an infinite set of numbers n for which some player ends up with all n pennies.

I also found a link to a listing of Putnam problems and solutions from 1938-2003! It’s in the sidebar.

Painting houses

Friday, January 21st, 2005

Given a positive integer k, how many strings of length k can you construct that satisfy the following restrictions: each character in the string is a ‘b’ or a ‘w’, no ‘b’ can be followed by a ‘b’.

One interesting thing about this problem is that it shows in a straightforward manner that the special number you get is always less than or equal to 2^k. For that reason alone, it’s an interesting problem.

Since I could solve this one in the first go, here’s my solution:
(more…)

Notes for Complex Analysis, Moore’s style

Wednesday, January 19th, 2005

I’ve taken 5 classes with G. Johnson, a math professor here at UH: Cal II, Cal III, a special problems course (more analysis), Intermediate Analysis, and this semester, an introduction to complex analysis. Why? Because he teaches using the Moore method, which is the way I always visualizing learning math in college would be. Even though we inevitably cover less material in his classes than I’d like, I feel that I remember more of what is taught, because I do the teaching for myself. And it is harder to get bored, since you’re doing all the work yourself. To practice my LaTeX and organizational skills, I’m typing up a copy of the notes, problems, and my solutions as we go along.