Saturday, April 26, 2008

Come on Linux, seriously?

I'm at a point in my career where I'm starting to publish papers with my advisor and potentially with authors I've never met face to face. I see this as the stepping stone to my future as an independent researcher. To promote simplicity in my career I want to build a foundation for consistency in my work, but in the spirit of collaboration I must be versed in the applications others prefer. By this, I'm referring to the platforms used to produce work (windows, linux, office, latex, matlab, c++,…).

Linux and Latex are two pieces of the platform puzzle I want to love, but simply cannot. The idea of open source goes right along with my thoughts on free information for all so I was eager to try these out. The newest Ubuntu distribution came out last week and I immediately got it, installed it, and was abhorred by it! I've read numerous articles on Digg and Slashdot about how Linux is making a serious run at the mainstream operating system race. This distribution is supposed to be as close as any to being a user friendly, efficient, and stable competitor to Windows and Mac. Needless to say I hate the fact that I am Microsoft dependent. Between Windows, Office, and all the other scientific software that is developed to run with them, I would be hard pressed to adopt another platform. Never the less, with all the options in Linux and the open source community, not to mention Vmware and Wine for my cannot-live-without Windows programs, I thought I could find a way.

I'd read an article that suggested Matlab run on Linux could run 25% faster than on Windows for a particular eigensolver code. My PhD will include a massive code for computing eigenvalues – one that I dread writing because debugging an eigensolver that could run for days can only be described as masochistic. My school has copies of Matlab and Mathematica for Linux so I was all set. I was going to get Ubuntu up and running, install Matlab and Mathematica and given those worked fine, get a hold of Vmware to continue my work in Word and Mathtype inside Linux. I installed Ubuntu. Beautiful! They really have the install process streamlined. Wubi comes with it so you can install a simulated dual boot. The partition manager makes it easy to set up a real dual boot. Beautiful! So now we're up and running. It starts much faster than Vista. Everything works right out of the gate. No updates, no drivers…it just works. Now it was time to install some programs. The synaptic manager and the general add/remove functionality is fantastic! I found the programs I wanted, checked the box, and boom, done! Beautiful! Then it was time to install Matlab and Mathematica. Mathematica first. I had .iso of both so I copied them from a SSH server set up in Vista. Easy as pie! It was apparent that Linux's network functionality both local and through SSH were far superior to windows by way of speed and ease of access. I need to mount the iso. I had used the add/remove programs manager to download gmount. I got it figured out fairly easily. Then I stared blankly at the desktop for a bit hoping, but not expecting something to happen. I had a little experience with Ubuntu before so I knew it hadn't had autorun functionality. That was one thing I saw as a logical advancement for this version of Ubuntu and was disappointed when it wasn't there. Another nice addition would be "automount" when an .iso is on the desktop or a disk is in the drive. Anyway, so how in the hell do you install this thing? I read for awhile trying to figure out the commands in the "user friendly" Ubuntu forums. The problem there is that MOST of the help is written to explain these things to Linux literate people. If I was that good I sure as hell wouldn't be looking in a forum for help on copying a file! It really comes across as snobbish. I imagine a socially deficient character sitting at a computer scoffing at the ignorance of the posters and purposefully leaving steps out! If we met face to face I bet you wouldn't be so f*#king smug! Mmm, serenity now! Anyway, not much help there, so I used the Force (Google) and sort of figured it out. In the terminal I had to point to the desktop by typing commands manually. FYI capitalization counts! From there I had to open the mount folder because I never found the command to explore the iso/cd. Then I had to point to the installer folder. Then I typed "install" and bingo! NOTHING HAPPENED! I tried /install, nothing. I tried the entire path, NOTHING! Finally somewhere on some website I saw a command "./install". I thought it was a typo where the period ended the last sentence and "/install" was the command starting the next sentence. It worked. Basically I got lucky.

Everything looks good until the install comes back with an error: "couldn't validate something." Back to the Force. I only got a working answer when I again got lucky and copied the correct combination of words into Google. It said I needed libraries installed. Sudo apt-get install <some obscure combination of abbreviated words>. That got it working fine. The rest was easy. Not too bad. Probably 2 hours from format to a working Mathematica. In Vista, it would have been slower to install the OS but faster (and easier) for Mathematica.

Now it's time for Matlab. This one had so many errors I didn't understand it was ridiculous! Instead of the Windows system; basically double click the install.exe and blindly click next until its finished, I had to make a directory. First problem, what are the commands and where do I put it. There is no intuitive name for the equivalent of "Program Files." A little searching and I figure out where and how to make my directory and get the licensing set up. From that point it was a downward spiral of fighting permissions, setting the target, and actually installing the program. I finally got it installed, but in my previous attempts I messed up the install and the workbench was incorrectly displayed. Of course I have no idea how to uninstall it in Linux so I formatted the whole thing and started over!

Round two was easier and everything was up and running. Time to test. I ran 10,000 points to generate a Poincare map for Duffing's equation…and waited…and waited…and waited! 36 seconds. I've got an identical machine on a kvm running Vista and the same version of Matlab so I switched over and ran it there. 26 seconds! Unbelievable! That translates to hours of wasted time waiting for a code to finish over the course of days or weeks. All this time spent and Vista still ran faster! Total time 8:30am-7:30pm – 1 hour for lunch. Total results=0. The next day I went back to Vista.

I'll make a brief comment on LaTex as well. I took a short course to see if it is better. I learned quickly that my method of derivation and writing cannot be done without a truetype environment. I messed around with LYX which is a graphical interface for LaTex and if I had to, I could use it. Beside the nongraphical interface, the commands are unintuitive. There is no point in me learning a whole new typesetting language (because that's what it is, a programming language) when I have nearly got all the bugs worked out of a much more powerful Microsoft Word.

Apt-get is an incredible tool IF you know the exact syntax of the program you want to install. The Synaptic program manager is an incredible tool IF the program you want is listed and clearly defined. Both are only worthwhile IF the program is hosted on their database. No automount, no installers, no computational speed, no customer! My hopes of becoming Microsoft free were dashed out for another 6 months.

This article is more oriented toward the problems a normal user might face.

http://contentconsumer.wordpress.com/2008/04/27/is-ubuntu-useable-enough-for-my-girlfriend/

And now a deep thought,

-I'm sure all the Linux Fanboys will have fun with their 700mb web browser.

P.S. Firefox 3 beta! Come on. There's not enough plug-in support yet!

Saturday, April 19, 2008

Running in the Rain: The Math

I always wanted to knuckle through this problem. So riding back from Florida I worked through the beginnings of it. Presented here is a preliminary mathematical analysis of whether it is better to walk or run in the rain.

It may seem natural that you would want to run in the rain and get through it as fast as you can, but the argument against it is that as you run the rain hits your forward facing area (vs. just hitting you on your upward facing area) thus making more area for the rain to hit. That way you get wetter. We will see how this idea pans out mathematically.

There are multiple ways to tackle this problem. I first started out with a continuum/flux analysis, but I found that since the raindrops are rather discreet points that it didn't make much intuitive sense to deal with them in this manner. Instead I looked at the problem in a different way.

In the end we are concerned with how many raindrops hit our body as we traveled from point A to point B. This would somehow correlate (not necessarily linearly) with how wet we got. We begin by looking at a field of raindrops. Shown above is a simple diagram of a snapshot in time of a field of raindrops. I am making the assumption for this initial study that they are falling straight down. What we need to find out is which of these raindrops we will intersect with. As we travel forward in space and time the raindrops will fall, the slope of the red line reflects upon this fact. As we travel forward, raindrops which once were higher will fall into our path where they will hit us. The slope of the red line is given by:

We can see the effect of this slope by looking at two situations: one if we travel really fast and another if we travel really slowly.

If we travel really fast so that Vperson >> Vrain we would essentially just chop out a section of raindrops. This area (D*h) times the # of raindrops per area (rhorain times your width) yields the total number of raindrops struck.

If instead we walk very very slowly we would expect that the area created by the arrows to be very large and as Vperson -> 0, we should be hit by an infinite amount of rain (at that point you are just standing in the rain.)

After we run the calculations for all situations we end up with:

Where D is the distance traveled, rhorain is the density of rain times your shoulder to shoulder width, w is your depth, front to back and h is your height. A simple equation, we can see that as Vme -> infinity then Rain Hit = rhorain*D*h. Also, if Vme -> 0 then Rain Hit -> infinity, just as we predicted.

The real interesting part is seen when the rain is falling straight down. As mentioned before, one would presume that when you run the rain comes at you at a larger angle and therefore you get struck by more rain, however the math shows that no matter what speed you travel the same number of rain drops will strike your forward facing surface. Fascinating.

To add complication, we are also interested when there are cross winds. Thus the rain isn't falling straight down.

The same idea follows, solve for the slopes and figure out the area of rain drops cut out. I'll spare you the math (I'll add a .pdf with all the details later.) In the end we get,

And there we have it. We look at the limits, as Vme -> inf, then Rain Hit = rhorain*D*h, like before. If Vrain_across=0, we get the same equation as before, which is correct. Also, if Vrain_across=Vme then we only get rain on our head, also correct. And what is the net conclusion from this equation… it is always better to run faster through the rain, no matter what. Below is a contour plot showing variations in your number of rain particles hit (red=lots of rain, blue = little rain) vs. horizontal rain velocity and human velocity. For reference walking speed is around 2-4 mph, and downward rain speed varies from 7-18 mph (I used 12 mph for this example.) You can see a minimum line when your speed equals that of the rain, this is when you are running with the rain. Also, for any given rain speed, running faster always results in less rain hit. The only exception may be if you are running with the rain and start to run faster than it, you could get slightly wetter, but not significantly.

In Conclusion I want to discuss some of the limitations of this study and address them. Firstly, this assumes you are a rectangle. Admittedly, for the majority of America this may not be true, but for an average person we are not too different from one. Also, the assumption that rain hit = wetness is not necessarily true, if a lot of rain is hitting on top of your head much of it may run off. Also, the relative velocity of the rain hitting you may dictate how well it penetrates your clothing (which is also a significant variable.) So keep in mind this is a limited study, but as all physics goes, starting with a simple model usually gives you significant insight into the problem and although it may not be perfect we still can learn something from it.

Thursday, April 17, 2008

Standing on Squares

A few weeks back I and several friends were at the Kennedy Space Center. They have this shuttle simulator deal where they sit you in a "shuttle" and then they use some interesting tricks to simulate acceleration, rocket vibration, and other such things. It was a terrific experience and I recommend everyone try it. Before we entered the shuttle we had to wait in a hall until the group ahead of us had gone through the video briefing. The briefing was also very well done. It was a little strange though. They had big plasma monitors mounted to robotic arms that moved around while the presentation went on. I'm not sure how or why, but it added to the excitement. Other effects were there for realism. Anyway, go see it for yourself. That's not what this post is about.

Here's the scenario: we're standing in the hallway waiting to go into the briefing room. The door opens and the first people start to walk in. It's an interesting room in the first place, as I've described, but the most interesting thing was a series of squares on the floor. They were clearly outlined square frames that were flush with the floor, about shoulder's width, and carefully organized in columns and rows. The first people immediately found a square to stand in. Of course the squares in the back filled up immediately. As more people came in, it became apparent that there were not enough squares for everyone and people began to hurry a little to ensure they could get a square. Mind you, nobody had mentioned the squares before we walked in.

I was in the middle of the group when I walked in. Immediately I saw everyone standing in their squares in perfect rows facing the monitors. My first reaction was "welcome to 1984, we must conform because Big Brother is watching!" I was pretty sure that the squares didn't mean anything and when I walked in there was still probably enough squares to go around. So I stood there in the middle gabbing away. Then I noticed that more and more people were coming in and there wasn't going to be enough squares for everyone. Then I thought maybe I missed something and we are supposed to stand on the squares. Maybe the number of squares equaled the number of people that can go on the simulator. How the hell was I supposed to know! Damn it! I knew better, but I hurried over to a square. Of course, I was right all along and they didn't matter one bit! Before the video briefing started every square had someone standing in it and a bunch of people without squares standing in the back. Just out of spite I stood to the right of my square, but it was futile. I'd already succumb to their treachery!

I see huge implementation in the little social experiment. If humans can be tricked to conform so easily, what other methods could be used to produce that sort of unforced group behavior? Hell, Pavlov had a harder time with his dogs than NASA did with us humans! If I ever get the opportunity to design a room where this could be appropriate, I'm definitely going to. I should mention that immediately before entering the simulator there were lines on the floor with dots on them. Everybody stood on those too. It was pretty obvious that those pertained to the number of seats in the simulator so I can't really compare the two situations. I don't think that dots would work so well though. The square frames on the floor were the perfect size for a human to stand in. The dots were much too small. I'd also think that the square shape would be more likely to cause that reaction. Maybe it is something about the straight lines running parallel and perpendicular to the monitors. I'm not sure. All I know is I felt used…

And now a deep thought…

If we can broadcast crystal clear FM radio, radio transmissions from the moon, and cell phones that work anywhere in the world, why the hell does our campus weather alert PA system sound like shit?

Sunday, April 13, 2008

The Theory of Barwanism

This is a simple thought, but it has profound implications. This simple theory was originally developed while I was living in Germany. They approach tipping in a different manner than in the US. The waiters in a restaurant or bar get paid a higher wage and therefore do not expect tips. Also, when someone would tip it would generally be much lower than in the US. As far as the wait staff is concerned they are getting paid pretty much the same, but for the costumer this system has deep implications. By limiting or removing the feedback process of tipping you eliminate a natural forcing towards better service. Much like natural evolution this causes a system which does not support the ‘most fit’ and thereby you get your beer much slower. I am going to refer to this as the theory of Barwanism.

This theory also applies to our home front as well. There is a trend which threatens to destroy the very foundations of our fast service. This is the guaranteed 15% tipping. By doing this everything works out the same as if the waiters or waitresses are getting no tip at all – if it is expected it does not promote better service. So what can we do as normal bar goers to see that we lead a happy, well served life? There are a few things.

One, don’t be afraid to vary your tipping based on the level of service. Going from 5-20% can be a good thing. Don’t use this as an excuse to be cheap, these people work hard and typically deserve their tips. We just need to use our funds appropriately. Secondly, giving positive feedback during the meal or drinks can help reinforce good behavior. Though, remember to be civil in your actions. I would not recommend giving much negative feedback to a poor server; we don’t need a bunch of self-righteous assholes running around. That is a terrible buzz kill. Third, for those of us guys who appreciate attractive waitresses, tip the more attractive ones higher. We are already gawking at them, now we need to understand that applying the same natural selection to hot waitresses is beneficial to us, especially in the long run. As long as hot women know that they can make good tips they will become waitresses. But keep in mind that a healthy balance must be achieved. Poor service still must be accounted for; otherwise the entire system will collapse. And four, please don’t over tip. This is creepy. She is not going to hook up with you because you tip well. Also, by over tipping the hot waitresses you could be inadvertently creating terrible waitresses. Ideally we want attractive fast servers.

So there you have it, vary your tips based on the ideals which you hold. It is the fundamental law of Barwanism (actually, it is just capitalism, but barwanism is more fun) and by understanding this we can make a real impact. Now go forth and change the world, one percentage at a time.

Friday, April 11, 2008

Movies I Hate: Run Lola Run

I love to watch films. I also like most of the movies I watch. I guess I just hate to hate a movie, but every now and then a movie comes along that I just despise. I recently watched a terrible movie and it reminded me of the other movies I hate. So in honor of that horrible film which brought up old memories, I hate Run Lola Run.

It is a German movie. (German title: Lola Rennt.) A friend of mine recommended it to me. That gave me the hope that it would at least be decent. Unfortunately things turned out otherwise. The movie is based on the premise of chaos: that a small initial change can lead to an unpredictably large one. This is a cool thought and fantastic to play with mathematically, but in a film it is a disaster (please note other awful movies such as Butterfly Effect.) The problem is that by showing a specific series of events (as you would in a movie) you defeat the entire premise of chaos and undermine the whole meaning of the idea. The only way it could work (for me) is if they could show every possible outcome. This is probably impossible, and if it is possible it probably would still be terrible.

Run Lola Run achieves its status as one of the few films I have turned off before finishing it by attempting to be deep and philosophic with its treatment of chaos. Instead it bitch slaps it (and the viewer) and gives us three outcomes from the slightly changed initial settings, three outcomes which are completely arbitrary and tell us nothing other than the fact that the best way to write a movie about chaos is to pull random shit out of your ass. Essentially the movie boils down to a ballad of ‘deus ex machina’ which is Latin for ‘God out of a machine.’ That’s the film term for when something magically happens to resolve a situation or move the plot along. It is lame. Anyone can write a script like that. (Notably, the best treatment of deus ex machina is in the movie Dodgeball. After losing, Vince Vaughn’s character suddenly reveals that he bet a ton of money on the other team. As their winnings are rolled out you can see ‘deus ex machina’ written in small letters on the container holding the dough.)

Back to being angry… So please, don’t write crappy scripts and pass them off as something smart. Honestly, for me, the worst part of the movie is seeing how many people really like it. It really makes me sad, sad for this world. Seriously, it is rated 8/10 on IMDB with 60,000 votes. I am about to tear up. Now go and do yourself and film and your soul a favor and don’t watch this movie.



Wednesday, April 9, 2008

Book Review: Surely You’re Joking, Mr. Feynman by Richard P. Feynman

This is going to be brief simply because this book is a collection of true stories illustrating the adventures of our favorite scientist/playboy, Richard Feynman.

I'm not even sure how to begin. I guess I will start by saying if you don't know who Richard Feynman is; it would behoove you to find out. He's an American physicist who has led an extraordinary life. He worked on the nuclear bomb, he won the Nobel Prize, he picked some very interesting locks, and is an artist. His travels have taken him from small town New York, to neighboring Cornell, to Brazil and Japan, and finally to CalTech. This book collects his adventures, social comments, and scientific achievements.

I knew some of the interesting things about Feynman beforehand. I had listened to the "Feynman tapes" which I think much of the book was transcribed from. I knew he was an ornery character, but that's not the half of it.

My one criticism is his "active effort toward social irresponsibility." I preach and preach social responsibility so of course I have a hard time when people do things that provide no social benefit for any sound reason. His active pursuit of social irresponsibility gave me a "what the hell" type feeling maybe 2 or 3 times. It seems to me his reoccurring theme was not to be socially irresponsible, but to sarcastically comment through his actions on the fundamental flaws inherent to common social practices and the egocentricism of lesser minded people. However, most of the good stories did come from some sort of action that would typically be unbecoming of a professor, or at least unusual. Clearly, it is those actions that are the reason he is so openly loved among the scientific community. Actions like doing physics research at a topless bar 6 days a week. Or by refusing to sign his name more than 13 times when asked to give a speech. Or by learning to play the drums in Brazil which ultimately led him, an established physicist, to play drums in a ballet years later under the presumption that he was a musician! We should all be so lucky to live with such zeal, enthusiasm, and wonder without repercussion or the need social appeasement. As a scientist I realize that it sometimes seems difficult to break the cycle of all work no play in order to enrich our life with art, or music, or the many other benefits of society. Feynman was exceptionally gifted at that.

Since it's hard to review incoherent collection of stories really can't say too much more about it. The book is great. The man is greater. He is a person we could all aspire to be socially, culturally, and academically!

And now, a deep thought…

Great minds are so awe inspiring; we sometimes perceive them as more than mere humans. It is comforting to know he likes naked women as much as I do!