Archive for November, 2007

Linux command shortcuts

November 28, 2007

After a lot of searching online I finally found a way to type a long command (or a series of them) on linux without actually typing it; you just type what you want to do like compile <program name> . What you do is this:

alias <theCommandNameYouWant>=”<TheCommand>”

If you want to add more commands to run at once use a ; sign in between the commands after the equal sign. More information is given in: How to use the alias command

CAUTION: don’t overuse the alias command because you might forget the real commands and try not to use relative addressing unless you have copies of different folders and the stuff in the folders is similar (in that case it is more convenient to go into the folder you want to compile for example and then run the aliased command there).

UPDATE: I tried doing what I said in the article and it worked as long as I don’t shutdown my computer. For some reason it doesn’t remember the alias. What you have to do is get to the .bashrc file in your user folder and type it there. In Red Hat Linux the file is in the user folder but it’s hidden so you have to “unhide it” before being able to see it. If anyone has any information about why linux doesn’t remember the alias or where to find the .bashrc file in other linux versions please write it down in the comments.

Cool math website

November 26, 2007

After doing a thermodynamics lab where we had to measure the area of a graph I thought we where going to have to scan the graph and use some fancy program to find the area. And yes there are programs for this. You can even use MATLAB (check this journal intro). But what we used to do this is called a planimeter. It’s two or one articulated arms that by moving the end of it around the shape you can get the area. A good explanation of how it works is in this website: http://whistleralley.com/math.htm. It also has some other “cool” math explanations. If they were to use the kinds of examples in that website in school more kids might find math usefull. But instead (this is just my opinion) they don’t get interested and they miss the basiscs and they just memorize equations and math becomes a chore; a hard subject. 

Random walk

November 22, 2007

As I was arguing today with someone, the average value of a random walk is not 0. And he wanted me to prove it. Well here is the true value of the average:  http://en.wikipedia.org/wiki/Random_walk. The gambler’s ruin problem (in the article) is a good example of random walk phenomena in real life (except for brownian motion). Here is a proof that the distance from 0 actually increases as time goes by: http://www.krellinst.org/UCES/archive/modules/monte/node4.html. If you go up the previous website you find this excellent website on Monte-Carlo methods:

http://www.krellinst.org/UCES/archive/modules/monte/node0.html

“Surfer dude” comes up with TOE

November 18, 2007

By TOE I mean theory of everything. Suposedly this physics PhD that has no university affiliantions came up with a new theory of everything. Here is the Telegraph article. And here is a comment about what comes up in your mind after reading the article.

Go see the movie Sicko

November 13, 2007

This is another controversial movie by Michael Moore. Here is the movie’s wikipedia entry. Out of all of his previous documentaries I found this one the least impartial since when he goes to visit an “average” french family he goes to visit a secretary and an engineer. Otherwise the documentary is really good.  

Artificial life courses

November 10, 2007

Here are some course websites I have found over the years. They have a lot of information.

Bionics course from Berlin’s Technical University (mostly in German)

“Artificial life as an approach to Artificial Intelligence” course from Indiana University. Taught by Larry Yaeger!

Evolutionary Computation and Artificial Life course from Ben-Gurion University in Israel

“Computational and Biochemical Theories of the Origin of Life” course from the Weizmann Institute of Science in Israel 

Artificial life course from Zurich University (good introductory info)

Digital Evolution and Biocomplexity course from Michigan State University. The wiki has lots of info on avida 

Biologically inspired computing course also from Indiana University 

Complex systems summer course co-organized by the Santa Fe Institute 

Evolutionary and Adaptive Systems course from the University of Sussex in the UK.

Artificial life in MATLAB?

November 7, 2007

While I was using Simulink (a program that comes with MATLAB) to make a model of a two-wheeled robot (using this equations) I was wondering as I always do: can this be used for making artificial life? After looking for a while on the internet I didn’t anything usefull. Besides EcoLab is supposed to do the same: solve differential equations. And it is made especially for artificial life. But nothing beats “drawing” the differential equations and getting an answer. So I used Simulink to simulate the Predator-Prey equations; otherwise known as the Lotka-Volterra equations. It’s not open-ended alife but it’s the closest I could get to it in an hour in Simulink.

Here is the model:

lotka_volterra3.jpg

The initial condition for Integrator is 15 and for Integrator1 it’s 16. Suprisingly you get a similar solution if you use 15 for both initial conditions; in theory both “species” should remain at 15 but because of rounding error the solutions diverge. For the simulation parameters I used a start time of 0, an end time of 10, a fixed step size of 0.001 and the solver “ode5(Dormand-Prince)”.

Here is the solution from the scope:

lotka_volterra1.jpg

Here is the output from the XY Graph component that graphs what its name says:

lotka_volterra2.jpg

John Conway in Youtube

November 3, 2007

Here’s a documentary segment with John Conway talking about The Game of Life:

This segment is from a documentary called: What we still don’t know.

The whole episode where the John Conway segment came from is in google video.

I also found an excellent Make magazine video about a kit that allows you to make a Game of Life board with LEDs and a PIC controller. You can also buy more of them and join them:

Getting address of variable in class

November 3, 2007

Today I tried to find out what was the problem with a CA program I was writing in c++ after the compiler gave me the following message: caArray is undefined. I was trying to pass the address of an entry in the caArray as a return value for a function. Other classes that modified the caArray didn’t give the error so I wasn’t sure what was happening. After some time I checked the definition and it was written just like the equivalent c definition but with the class name in front:

int <class name>::*<function name> 

But it should be defined like:

int *<class name>::<function name>

I know this seems like a stupid mistake for a c++ programmer but it might be a problem for someone starting with c++ from c, especially with the fact that the error message doesn’t say the definition is wrong.