Saturday, April 26, 2008

Of Physics, computers and Linux

As any other occupation, computational physics has its tools. It's commonly said that doing theoretical physics research doesn't require a big budget, you just need a pen a lots of paper sheets! Well, you actually also need access to books, journals and --- in these times --- you do the messy algebra in a computer.

For me, it's been a lot of fun doing computational physics. In a way, it is a subare of theoretical physics. What you do amounts to solve physics problems by implementing numerical algorithms in the computer. The kind of problems that you solve involve very complicated equations for which no general analytic solution is known. These problems range from solving quantum mechanical equations for molecular structures to protein folding simulations to fluid dynamics, global climate, galaxy formation and many, many more.

My particular area of action is numerical relativity. We solve Einstein's general relativity equations to find out the behavior of the immensely strong gravitational fields produced in the collision of stellar objects such as black holes and neutron stars. General relativity predicts that in such collision events, huge amounts of energy are radiated away in the form of gravitational waves. Simulating such scenarios has proved to be an enormous challenge in computational physics.

So what are the tools that computational scientists around the world use in their cutting edge research? The answer is very simple. They use a few applications that come with any standard distribution of Linux. Yes, Linux user, in your laptop or desktop you have the same basic tools as any other computational scientist.

Based on my own experience in the numerical relativity field, I've compiled a list of the applications I use in my everyday research. They come with your favorite Linux distro [1] and if they don't, they available for free on the web. Let's start.

  • Linux terminal A little window where you type all sorts of commands. Some that I find myself typing all the time are:

  • ssh It allows you to connect the a remote computer and work (in a terminal) as if you were physically in front of it.

  • rsync The best way of copying large amounts of data between two computers. It encrypts the data and copies only what is different. Ideal for making periodic backups.

  • cvs, svn, darcs, git These are all versioning systems. If you develop your own code it keeps track of all the changes, making possible to go back to a previous version if you screw it up. It happens!

  • latex. The best way of preparing documents and presentations. You can write equations and tables without touching the mouse. It numerates chapters, sections, subsections, figures, tables, lists and equations automatically. If you have to insert a figure or table it corrects all the numbering sequence and also the references to them. It handles the bibliography in the same way and generates the index automatically too! What else could you possibly ask?

  • gnuplot Excellent for doing curve fitting, 2D and 3D plots. It's command-based and you can also make scripts with it, automatizing the generation of new graphs when you have new data. This substitutes the spread-sheet sort of graphs.


You also need some coding tools:



  • Text editor The most used are emacs and vi. Personally, I stick to emacs.

  • GNU compiler For your C, C++ or fortran code.

  • Parallel computing libraries OpenMP to make your code run in all the cores of your machine. MPI to make your code run in different computers at the same time. This is how high performance computing is done.

  • Perl or shell scripting To handle small repetitive tasks.


I think this covers most of it. Give or take depending on specific problems and specific people :) [2]


I could also include the chat application. It's very useful for asking small questions or some advice. You can always go to the chat logs if you forget a little detail.


Summarizing, any person with the inclination for science or engineering has all the needed tools to transform his/her computer from a fancy typewriter to a full fleshed computational work-station.


Needless to say, this is another nice trait of the Linux operative system.


_____________________

[1] Some people also use Macs.
[2] Packages like Mathematica and Matlab are also very useful but they are not free.

Monday, April 21, 2008

Feynman's drumming and stories


Almost a year ago some friends showed me a peculiar cd that they got. It was the Safecraker suite: Drumming and storytelling. The cd was a collection of Richard Feynman's stories about how he managed to open the safes while he was at Los Alamos working in the nuclear bomb project. The stories alternate with drumming sessions featuring Feynman playing the bongos. To my surprise, track 3 contains a tune called Interaction by Three Quarks (Guatemala, Bongo Bash). It mimics the rhythm and acoustics of the native folkloric Guatemalan dances. It's really awesome!

Now I found this little video of him playing the bongos. Such a cool guy!



Thursday, April 17, 2008

Spectus and Ferox

Spectus: Sometimes I feel nostalgic when I ponder about all those things that I will not be able to live.

Ferox: Life is finite and so is the amount of things you can do in that interval of time.

Spectus: That is not what I mean. I mean that sometimes I think of the many other things I could have done in my life, but I will not do because certain decisions in life will exclude others of being possible.

Ferox: Why do you worry about that? They are things that will never be.

Spectus: But they could be... if I so choose.

Ferox: Ah... and what is the point?

Spectus: The point is that out of many instances of my life, I can just live one. I can't help thinking about how would my life be if my choices and actions were different.

Ferox: I see. Well, I don't know what to say... I don't think it's important to consider such matters. There's nothing you can do about it, they are out of our reach.

Spectus: I know. Yet I wonder, why is it like that?

Ferox: You are going nowhere. This is the way things are. That is how nature works.

Spectus: But still, those questions wander in my mind. They pop up involuntarily, to put it in some way. I don't control that. It's like my brain is wired in such a way that it happens like that. I guess you could say the same about that phenomenon, that that is the way in which nature works.

Ferox: Yes, I would say that.


After a short silence Spectus looks perturbed.


Spectus: But then, Ferox, forgive me to go on with this, I know you are a more practical thinker; but don't you feel that there is something missing here? like we are missing the point?

Ferox: What point?

Spectus: Let me explain. You said that I can only live one life based on my choices and decisions, it does not matter whatsoever that I have thoughts about the many other possibilities. In nature, only one choice is realized. I am part of
nature, those thoughts live in my brain. So, is it not like those thoughts are some sort of realization of the other choices? As if those possibilities that will never be had some level of existence in my brain when I think about them.

Ferox: Hmm, thoughts don't seem to have a life of their own. They don't exist if you don't exist. As opposed to the real world that exists independently of yourself.

Spectus: Is that so?

Ferox: Of course it is! Why? Are you challenging even that?

Spectus: I don't know. It seems to me that when we are so used to something we take it as an incontrovertible fact. What if the reality that we experience is just some particular way of seeing things? It's like staring at a static object always from the same position. We always see the same. But as soon as we change the point of view---literally---other features of the object become visible.

Ferox: Hmm...

Spectus: What I'm saying is that we perceive an external world through our senses. And that, my friend, it's the only possible way for us to know about that external world. The images, sounds, flavors, colors, etc. all the attributes you can think of an object and that are stored in your memory, rely on the complex structure of your nervous system; from the perception, analysis and storage in memory. All human beings possess those capabilities. Now, the questions is, could we experience reality in a different way if our nervous system, for instance, had a different design? Is it even possible to have a different design? and if it's possible, how would that reality be? Would the laws of physics be the same but written in terms of other "observable" quantities?

Ferox: You blow my mind... I have absolutely no idea. Do you think there are answers to such questions?

Spectus: I don't know. Maybe the answers lie ahead, in the future. When we gather more knowledge and more experience.

A small pause...

We have gained an enormous amount of knowledge about how nature works, to the point that physics has managed to reduce all phenomena in nature to a few fundamental interactions. But those interactions and the theories made to account for them, are made based in our own perception of the reality. I think that in the future, the theories of physics will be regarded as the way of explaining nature according to human perception. I've started to think that we can not consider a fundamental law as universal. I would say that it is universal to account for the phenomena that we experience. Thus, we can not consider a physical theory as independent of its creator. The next step in the path of fundamental theories will be a set of knowledge that relates the outer world and how it is conceived in the mind of the observer. In other words, it would be a theory of the external world and the conscious processes of its creation. A theory about the creation of theories! Would this give us a theory of consciousness? I don't know. But I feel that it points in that direction.

Ferox: I admit I don't delve very often into these issues, but I can't deny that they are very interesting. It makes me wonder where does it end, if it ends. Are we going to quest answers forever?

Spectus: I don't know... Let's get back to reality for now.
...
What's the tally?

Ferox: Oh, we are just starting.