Archive for December, 2004

Test run of IllustRender

Friday, December 31st, 2004

When the IllustRender plugin is configured correctly, this will be a wonderful graphic, taken from the LaTeX Graphics Companion:

here ->

pickup pencircle scaled 4pt yscaled .2pt rotated 60;
n := 5;
for i:= (n*20) step -(n) until (n):
 draw (i,0)..(0,i)..(-i,0)..(0,-(i-n))..(i-n,0);
endfor
and another here if everything is seamless, as opposed to just sort of working->

picture p; path q;
p := thelabel(btex \Large
\begin{minipage}{4in}
\begin{gather}
\iint\limits_A f(x,y)\,dx\,dy\qquad
\iiint\limits_A f(x,y,z)\,dx\,dy\,dz\
\iiiint\limits_A f(w,x,y,z)\,dw\,dx\,dy\,dz
\qquad\idotsint\limits_A f(x_1,\dots,x_k)
\end{gather}
\end{minipage}
etex,(0,0));
q := fullcircle scaled 2.5in;
fill q withcolor black;
clip p to q;
draw p rotated (90) withcolor white;

Update: IllustRender seems to be working now. Just a few cosmetics and convenience issues to address before it is ready for public consumption. While working on it, I realized that neither it nor LatexRender would handle the case where MetaFont had to run in order to generate a couple of fonts for a document well, if MetaFont ran too long— because, if I recall correctly, as a security feature, servers kill scripts that take longer than a few seconds to run. That issue doesn’t seem to affect LatexRender though, and a person is much more likely to change fonts in TeX code than in MetaPost code, so I’m going to ignore it. While I’m at it, I’m going to add support for Postscript (and bundle it with PSMath), so that folk who don’t have access to mpost (although, if they have access to latex, they probably would also have access to mpost) can use that; also, who doesn’t want choices?

Here is a sample of Postscript code, using the PSMath library. It is a depiction of the Mercedes-Benz frame in \mathcal{R}^2:


%PS
% The Mercedes-Benz frame in R^2
100 100 translate
 .55 .55 scale
/makeaxes {
          O [0 1] vsub len 1.15 mul smul O [0 1] vadd len 1.15 mul smul arrow
          gsave
          0.25 setgray fill
          grestore
          O [1 0] vsub len 1.15 mul smul O [1 0] vadd len 1.15 mul smul arrow
          gsave
          0.25 setgray fill
          grestore
          stroke
} def
/drawvect {
        O vadd O exch len smul varrow
        gsave
        1 setgray fill
        grestore
        stroke
} def
% pass-in length, vectors
/makeillust {
            /vects xdef
            /len xdef
            lw-dec
            makeaxes
            lw-std
            1 1 vects length {
              1 sub vects exch get drawvect
            } for
} def
/O [0 0] def
/frame1 [ [1 0] [120 cos 120 sin] [240 cos 240 sin] ] def
/len1 1 inch def
/frame2 [ [1 0] [120 cos 120 sin] [60 cos 60 sin] ] def
/len2 1 inch def
/frame3 [ [30 cos 30 sin] [90 cos 90 sin] [150 cos 150 sin] ] def
/len3 1 inch def
gsave
len1 frame1 makeillust
2.6 inch 0 translate
len2 frame2 makeillust
2.6 inch 0 translate
len3 frame3 makeillust
grestore
(Mercedes-Benz tight frame in $R^2$) [2.6 inch -1.5 inch] 2 2 label

Commenting System Broke

Friday, December 31st, 2004

Ok, I’ve been trying to install wpSubscribeToComment, so when you make a comment and someone (like myself) posts a reply comment, you would receive notification. Unfortunately, this is proving to be harder than it should be, and I’m off to do other things at the moment, so the comment system is broken for now. Later today I’ll either track the problem down and fix it, or give up on the plugin.

Update: I fixed the problem, although I still don’t know what was causing it (I ended up just renaming one of the files), so now the plugin doesn’t screw everything up. It would even be working, if my server was set up to send email. But apparently, it isn’t, so no emails for me until I get that setup.

A hard digit problem

Thursday, December 30th, 2004

Strike the first digit of the number 7^{1996}, and then add it to the remaining number. Repeat this process until a ten digit number remains. Prove that this number has two equal digits.

I have no idea how to attack this problem. I love a challenge…

WP Plugin thoughts

Thursday, December 30th, 2004

I wish someone would develop a plugin that made it easy to generate illustrations from within WP, using PS, MetaPost, or something similar. It would make it a lot easier to add explanatory figures to math/science related entries. Oh well. And what about some kind of system that announces when new comments have been posted?

An interesting equation

Tuesday, December 28th, 2004

Solve this equation: \left(x^2-3x+3\right)^2-3\left(x^2-3x+3\right) +3=x.

I already got the two `easy’ roots, but I haven’t been able to get the other two. Maybe I’ll have to resort to expanding the polynomial and using synthetic division, but considering the source of this problem, I think there is a more elegant solution than that.

Update: I couldn’t find such an elegant manner of finishing the problem, so I peeked at the solution, and found that they did use synthetic division! Moral being, don’t be afraid of a little grunt work…

Java just keeps getting better!

Monday, December 27th, 2004

I started investigating the Java Postscript interpreter that I mentioned previously: the code is actually pretty straightforward, despite the fact that there are no comments. That is impressive: if the same code was in C, I think it would be a lot harder to follow, what with pointers and enums, structs. Of course, I’ve been helped along by Eclipse, which is very useful for keeping things in context: it has mousetips that tell you the fully qualified type of the object the mouse is hovering over, and if you click on the object, say a function, it displays the declaration of the object in a pane. Furthermore, you can browse the class hierarchy and function call trees. Eclipse would be darn near perfect— only thing is, my computer is way too slow to run a Java application as large as it, and it doesn’t seem to have any easy way to access the Java SDK documentation

Inspired by this experience, I started combing the web for interesting examples of Java in use, and discovered gJ and Pizza, which enhance Java by adding generics, which are like the templates in C++. I’m surprised Java doesn’t already implement generics, but it seems that Sun is seriously considering adding it; having generics would make it simpler to handle functions that expect arrays of arbitrary object: instead of just fname(Object [] arr), you could have something like fname(<type> [] arr), and Object [] fname() could be replaced by <type> [] fname(), which would make error checking easier, because it wouldn’t be possible to sneak in an apple into an array of oranges, for example.

I also looked up native compilation— it turns out that actual native compilation might not actually occur, just wrapping an EXE around a call to the JVM– and compilation of `assembly’ code to bytecode.

A Selfish Number

Saturday, December 25th, 2004

Here’s what I call the `selfish’ number problem:

Find a ten digit number a_0a_1a_2a_3a_4a_5a_6a_7a_8a_9 which satisfies the condition that there are a_k occurences of the digit k in the number.

This was a fun problem, although I had trouble getting what it was asking for at first— for some reason, I imagined the digits weren’t repeatable, but that makes the problem obviously impossible. Then I tried constructing a list of how many times each digit could possibly occur (e.g. no digit can occur 9 times), and cross referencing the lists to form a number that works.

Ironically, I didn’t get the problem until after I had wrote a code to exhaustively test all ten digit numbers, using brute force (yep, searching 10^9 numbers). I said, yeah that’s a lot of numbers, but still, this can be done in a reasonable amount of time… ha ha. When I realized not, I ended up trying basically the same list construction that I mention before, to optimize the number space being searched (e.g. the for loop that determined a_0 doesn’t have to go all the way from 0 to 9). In doing this, I found the answer.

I didn’t realize it at the time, but the answer is obviously unique. I think I was doing this around 1 in the morning, and was already dead exhausted before starting, so I forgive myself.

And now… Christmas!

Saturday, December 25th, 2004

Of course I’m going to make a Christmas related post! And there is so much too:

First, everyone in my family goes to church on Saturday (they’re Seventh-day Adventists) but me, usually. My weekly clock used to be set by the fact that church occurred on Saturday: bitter anxiousness on a Friday afternoon, that Church is tomorrow, and I need to prepare— memorize memory verses, learn a poem for the afternoon program, read part of the Bible— resentment that I couldn’t watch tv from Friday sunset until Saturday sunset, then Saturday itself, wasted dressed up and in church, being various preached at, excluded by those my age, and asleep. Saturday and Sunday were then a benison— Saturday was tv night from sunset until I felt too sleepy to continue, about midnight, eagerly looked forward to; Sunday was at first free day (except when the church equivalent of Boy & Girl Scouts had a meeting), then in high school and college work day, when I could catch up on homework.

The point is, Saturday was the day that marked the end of one week for me, and the beginning of another. I marked the progression of time using Saturday as the milepost. Now, since I don’t go to church any longer, I have no milepost, and the weeks blend into one another. I became fully conscious of that fact today— I think I internalized it a while ago— because Christmas has disrupted my entire family’s routine to the point where it is hard for me to keep in mind that I still can’t turn on the tv after dinner because it is Saturday. Probably it’s harder to mind myself because everyone stayed home today, which is rare for Saturdays.

Second, there was a local news segment on how the Christmas season is losing its rason d’ etre because it is becoming so PC. People said “Merry Christmas”, then “Merry X-mas”, then “Happy holidays”; now one can’t even settle for saying “Happy Hannukah” and “Merry Christmas”, or even including “Enjoy Kwanza”, but must give completely generic holiday salutations in order to avoid a negative perception. I agree. This is a symptom, and not the only one, that the world has lost sight of the spirit and meaning of Christmas; now it has degenerated to a purely commerical enterprise. Thanksgiving is more like Christmas than Christmas.

About thewhole gift giving concept. I think the whole thing is a ploy to get people to spend their cash and overload their charge cards. There are better ways to let people know how much they mean to you than to buy them gifts. Besides, who needs all the anxiety and debt? I sure don’t.

NRC Rankings

Saturday, December 25th, 2004

Researching graduate schools has become an obsession with me. I guess it’s because I’m feeling guilty about my decision to take an extra year to complete my math degree— like I’m cheating, or being self-indulgent. Despite the considerable time invested in this pursuit, I still haven’t settled on the schools I’ll be applying at.

Just now, I was cruising around on the UH math site when I came across the latest (1995) National Research Council rankings of mathematics graduate programs. This picqued my interest, because I’ve never heard of the NRC ranking before, but it seems like it should be a prestigious metric. I found a synopsis of NRC rankings in various fields from the same year, at UCB.

Surprisingly, UCB is listed as the school with the most distinguished programs; I would have expected it to be Stanford, or Harvard, a school of that ilk. I’ve always viewed UCB as a free-spirit school. Not surprisingly, UCB is ranked number one in the math field; that goes without saying, in my opinion, no matter who does the ranking. Surprisingly, Caltech didn’t score as high as I thought it would in any area. But you know what, it did way better than I had anticipated (admittedly solely judging from the facts that Caltech is mostly known for the physics/engineering done there, and their math website is extremely small and sparse looking, and they don’t seem to have a very varied list of active research topics) on the mathematics ranking. So, I will definitely be applying there— even if I blew my undergrad opportunity, I can still hang out with the undergrads and live vicariously :) Plus I’m sure the grad scene is exciting; if not in the math department, I’ll just pop over to the physics department.

Lucky for me, lots of schools in the top ranking are in California: Stanford, CalTech, UCB, Princeton, UCLA, Yale (is in California, right?). So I definitely will be applying to those ones.

Here’s a list of possible candidates from the NRC rankings:
UCB (1), Princeton (2), MIT (3), Harvard (4), U Chicago (5), Stanford (6), Yale (7), Cal Tech (11), UCLA (14), Cal San Diego (17), U Illinois Urbana-Champagne (21), UT Austin (23), Purdue (24), Rice (25), U Illinois Chicago (32), U of Arizona (53), Cal Santa Cruz (55), A&M (63), UH (67).

Of course, this list will be considerably shortened, and I haven’t included foreign schools like Edinburgh, Oxford, Cambridge, or anywhere in Germany (they fully subsidize your education, even as a grad student!). Also, I have to see what the environment is like at all these schools.

BTW, I am not a ranking whore. I just want to be the best, and part of the best :)