05.30.06
Posted in Mathematics, ruby/rails at 1:11 pm by Haris
This post has gotten a bit longer than expected, so a quick summary is in order here: If you run Ruby 1.8.2 or earlier, be very careful about using rational.rb and mathn.rb. The algorithms in there for computing the gcd of numbers, necessary in almost every operation, are from kind of bad to utterly horrible, and in particular in one of my projects 30% of the program time was spent in computing gcds.
Ok, and now for our feature presentation:
Read the rest of this entry »
Permalink
05.16.06
Posted in computers at 6:27 pm by Haris
Now that the new MacBooks are out, I am tempted more and more to get a new laptop. But after all the trouble that Daniel Jarkut has been going through, and seeing the huge percentage of people who seem to be having problems with their MacBook Pros, I think I’ll have to wait a bit longer and see. I have to say that Apple’s stand on this matter mystifies me. They seem to claim that the whine and the heat and all that is “within specs” and not really an issue, but from the reports I am seeing I just don’t buy it. I’d love to get my hands on one of those noisy babies, just to see how irritating it is.
Update: Pierre Igot seems to be having similar problems, and in fact with a MacBook, and is quite unhappy about it. He is returning the machine and, to add insult to injury, he found out that he will have to pay a 10% restocking fee because his computer was “custom made”, i.e. had some RAM added! Initially they were actually refusing to take it back at all!! Are you listening Apple? This kind of treatment is unacceptable, and it hurts the company’s reputation. I better start looking for a different gift to myself for when I finish my thesis….
Update 2: Good news for Daniel
Later
Permalink
05.15.06
Posted in Mathematics at 3:27 am by Haris
We all learn at some point in time how to approximate real roots of functions via Newton’s method. To refresh your memory, Newton’s method is a wonderful simple iterative process that, given a differentiable function, produces a sequence of numbers that, if it converges to some number, then that number is guaranteed to be a root. In fact, there is a very straightforward geometric interpretation of the method, which can be summarized in the sentence:
Follow the tangent line to the curve at your current x0, and see where it meets the x axis. Then use this intercept as the next x0.
Drawing a picture will convince you immediately. But what about complex functions and complex roots? Will Newton’s method work then? It would largely depend on the point you start. For instance, to find roots to
, using Newton’s method, if we start with a real value we will remain within the real numbers, and thus will never reach the two imaginary roots. Imagine even more complicated functions.
Ok, so the general problem might not be too easy, but what about the special case of polynomials? Surely there should be an easy way for polynomials!
There’s some obvious things you can do. For instance, you can compute the greatest common divisor of your polynomial and its derivative, and if this divisor is not a constant, then its roots are multiple roots of your polynomials. Since this g.c.d has smaller degree, this can make our live easier, as we can apply whatever method we have to the two factors that we get this way.
Ok, that wasn’t very interesting, right? Chances are that all the roots of the polynomial are distinct. I just found out that there is a wonderful method, called the Durand-Kerner method, which, when applied to a polynomial with distinct roots, gives us all the roots at the same time, pretty fast and with great precision. The idea is to start with a random set of numbers as our initial guesses for the roots, and keep improving them all at the same time via a very simple iterative process.
I haven’t seen the theory behind this method, but I implemented it and it works great! It will not work for a polynomial of degree less than 2 though, so you’ll have to find some other way to compute the roots of those polynomials
.
Permalink
05.12.06
Posted in Uncategorized, Mac OS X at 7:03 pm by Haris
Today I almost bought a song from the iTunes Music Store for the first time. From some time last night I had this song stuck in my head, that I did not know the title for, but that I could not get out of my head. So I had to find more about it. Luckily I remembered some of the lyrics, so I found that the song was Mad World from Tears for Fears. So I fired up iTunes and went to the music store to hear the song.
Now, I should say that I almost never get individual songs. I like getting whole albums, with their artwork and everything, even though I quickly move them to iTunes and almost never hear them from the CD again. I just like that it’s there, sometimes with some interesting trivia and often the lyrics, and at the very least some lovely images. For me the CD cover artwork is an integral part of the album. So all this is to say that I really wanted to find this song, and was really hoping to like the songs in the album enough to dive into it and get the whole thing.
So onwards I go to the iTunes Music store, and find the song. However, it turns out that the version by Tears for Fears was not the one I wanted. So I looked around at the other links that showed up, and lo and behold, I saw the Donnie Darko soundtrack, and it all clicked: That’s where I had first heard it! It turns out this is a cover by Gary Jules, and Michael Andrews, and the Donnie Darko soundtrack contains two versions of it. So I went to the soundtrack, and heard some of the other songs in the album, to see if I like them. Turns out I did not like any of the other pieces in there at all, so I decided to go ahead and just buy the song itself. That’s when I saw this:

Not cool Apple, not cool…. You’ve lost me as a customer, as far as the iTunes Music Store is concerned.
Luckily, I found two videos of the song on YouTube. Yey!
Later
Permalink
Posted in computers at 12:39 pm by Haris
I have very weak wrists, and consequently I have tremendously appreciated the feel of the keys on my iBook, and I can’t stand typing on the big apple keyboard in my office desktop. So now that I am thinking of getting a desktop computer for my office at my new home, I need to find a keyboard that is close enough. It is an absolute requirement that it has a short key travel time, the keys are easy to press, and that the function keys are easily within reach, and preferably on both sides. My current two candidates are the Kensington Slim Type and the Macally iceKey, and I would also consider the much cheaper ikeyslim if I could find any reviews of it. Right now I am leaning on the iceKey.
Any thoughts or suggestions?
Later
Permalink