
NetLogo 01
To be prepared for a post about the Santa -Fe institute, I need to introduce you to this program.

NetLogo is a program to simulate agent-based models using object-oriented programming. What that mean?
A model based on agents is a model of a system where you suppose the system formed by different entities called agents. A model of a solid made by atoms si an example where the agents are the atoms. Is that all? No. An agent-based model must include agents and rules to interact between them. And mos important, the properties of the system must arise as a collective property of the agents. For example, in the solid, the net magnetization must arise as the interaction between the spins of the individual atoms.
Ok, seems like agent oriented models is more or lees what we have been doing for a long time in some simulations. Why so much noise about this program? Because the object-oriented programming is the way of programming agent-based simulations. What do I mean with that? You can program anything with any language (there is a theorem that grants that), but depending on the task and the language used, the problem became easy or a complete hell. So using object-oriented programming is the easy way of dealing with agent-oriented models.
Enough.
Go to the webpage, hit download, fill the questionnaire (if you wish you don’t need to fill it), and download and install the program.
Now that you did that, run the program for first time,k it will look something like this.

From here, you are only interested in “Interface” and “code”. Interface is where things happen and where you put buttons and sliders to control your simulation. And also, where the graphics and plots will appear. The code view is where you actually write the code for your simulation.
To start with something easy, go to File>Models Library and we are going to choose…. Chemistry and Physics>Ising.

The Ising model is a classical model for magnetism. In this case, each agent is going to behave like a magnet which can be pointing up or down (dark or bright). The agents randomly will be allowed to change their orientation if that minimises their potential energy respects it’s neighbours. And sometimes, randomly also, they will go into a bad configuration. The principal parameter on this model is temperature. Temperature determines the amount of bad random changes. And the interesting result is that below a certain temperature, the system evolves towards all the agents in the same state, while over that temperature the agents in one state equal the agents in the other state. And that is a good example about magnetic domain formation and Curie temperature.
To run the simulation, push setup-random to initialise the variables and then go to run it.

Hmmm but this representation of the results is not funny. To make it more funny, we are going to plot the average spin versus temperature. To do it, right click on the plot and hit edit. And now we only need to remove the pen that draws the horizontal line and change ticks for temperature. So now, each time the plot updates with a new point, the new point is going to have temperature as x and average spin as y. You can also change the axis limits to fit better the new data.
And now, just change the plotting-interval to maximum, hit setup-random, go…. and ramp up and down the temperature several times slowly (there is a slider on top to accelerate the simulation).

That process is the equivalent to have a magnetic material and cool it down and heat it up several times. You are going to see that sometimes, when you cool it down, you end with a magnetization different from zero, maybe 1. But above some temperature, the magnetization it’s always zero. Something like this.

That transition temperature is what we call Curie temperature.
Ok, so now with a first example.
Step 1: Help>Look up dictionary This will help you quite a lot.
Step 2: File>New.
Step 3: Create a SETUP button. Right click on a white area and add a button. On the window that appears, writet in the commands area SETUP. And hit ok.
Setp 4 Create a GO button. Rigth click on a white area and add a button. On the window that appears, writet in the commands area GO, select forever. And hit ok.
It will look something like this.

This buttons will execute the scripts located in the CODE area with the names SETUP and GO.
Setp 5 Switch to code area and write the commands to SETUP and GO
Setp 6 We write for setup these lines to create 160 turtles (turtle is the generic name for the agents).
to SETUP clear-all ;; create 160 turtles at the center pointing at diferent random angles and positions ;; with different colors create-turtles 160 ask turtles [ setxy random-xcor random-ycor] ;; ticks are used to measure time, how many interactions has pased reset-ticks tick end
Setp 7 In each iteration step we ask turtles with same colors to move closer together.
to GO ask turtles [ ;; In order, each turtle is asked to do something ;; In this example we pick a random turtle and compare color with the actual turtle let a one-of turtles ;; If the color is the same, as the current one, the current one moves towards that turtle. if color = [color ] of a [face a fd 1] ] tick end
All together will look like this.

Setp 8 With all the steps sccomplished, run the simulation.

Like it? Want more? Ok, one more. I show you how is going my random forest on NetLogo. (Remember my version on OpenProcessing?)

Prof. Walter Lewin
Today I’m doing my final exam of the MIT online course Electricity and Magnetism, by Prof. Wlater Lewin.

This course has been supported by the online platform edX for free online courses (recently it becames one year old).
I cann’t share thew videos from the lectures, which is a shame, because Prof. Lewin is simply awesome, EPIC. But I can share a few tricks for this online courses.
1 Enroll only in the courses you are completely sure you can follow. You need time, is necesarry to work a few hours every week, you effort quite a lot to not give up and follow the course trough all the weeks, and you need to be able to not skyp any week.
2 Writte down the important dates carefully. The most comon problem which happens in these courses is that people forget to save time to do homework or exams.
3 Forums and chats can be a good tool or a complete maddness. Get involved but don’t get mad. Usually a problem can be solved with the help of the forums, but in other cases is not necesary at all to use them.
4 Know your tools. I have 2 main tools for this course:
The first one, is the online Wolfram search engine, Wolfram Alpha.

This is an amazing tool and for sure will become bigger and powerful in the future. The good thing? You can basically use it as a code interpreter for Mathematica commands… but also for Matlab, Maple or any other mathematical program you know. It is able to recognize your commands and interpret them. Example:

Note 1: You can have the computation as a link copying the direction of the webpage, so for instance, if you click on the image, it will lead you to the webpage with the calculation.
Note 2: The animation that appears while the computation is being performed is a simulation of Conway’s game of life.
The second one is HyperPhysics, a webpage hosted by the Georgia University and which is a good resource for basic physics with loots of useful formulas and examples.
One of the better things about this webpage is that it has related content where ever you go. So if you don’t know exactly what to look for, you just start looking and eventually links will gide you to the correct answer.
Finally, last advices.
5 Don’t give up. If you fail to complete one task, maybe you can still apply for completeness certificate.
6 In every single course I get good grades at the beguining and bad grades at the end. It hapens to be with time and enthusiams. And you know? good grades at the beguining help me pass, so try to do it as best as possible when you still can.
And now, some videos I manage to get from the course. Enjoy the experiments!! (Note that they are lectures, so the experiments usually came at the end).
Levitation of a woman.
Playing with Van der Graaf
Actually created a Kelvin Water Dropper.
Daffodils for first time you see Maxwell Equations.
Rainbows are polarized.
Students singing to Prof. Lewin. “Help me Prof Lewin…”
From here I want to give thanks to Prof Lewin for one incredible experience. I really enjoy your lessons and going back again through electromagnetism was spectacular with you. Thank you.
.
.
.
.
Want more? I have more…. Classical Mechanics course with Walter Lewin is starting in september. I’m going to join just for fun and maybe to refresh one or two things. I encourage you quite a lot to take it.
Pop culture Cars.
This is the new poster that is hitting all the geek web pages. And most of them don’t have the correct reference to the author. Here it is, Scott Park.
ASFoW (Awesome Short Film of the Week).
Today M.E. (Mysterious Explorer). Has pointed me into this EPIC short film. Because we all want a film with Link’s adventures.
SUPER Cooperators.

Original title: Super Cooperators: Altruism, Evolution, and Why We Need Each Other to Succeed.
Title of this edition: Super Cooperators: Altruism, Evolution, and Why We Need Each Other to Succeed.
Author: Martin A. Nowak, Roger Highfield.
Gender: Science Divulgation.
Saga: —.
Editorial: Free Press.
Edition year: 1, 2011.
Prizes: …
Synopsis [Warning: Spoiler]: Martin A. Nowak is Professor of Biology and Mathematics and Director of the Program for Evolutionary Dynamics at Harvard University.

This book is a small resume of his career and the problems he has been working on. His life has been dedicated to mathematics. His studies are about evolution and cooperation, and how is evolution with cooperation the true game played by life.
Personal Review: I was preparing a course for the Santa-Fe institute about complex systems when we came across this book. Was one of the suggested readings. It´s not a practical book, it´s just a nice travel into the lands of evolution and cooperation.
It´s very dangerous to resume in a few words what the book is about, but I will try to give you an idea. Basically, evolution, the subsistence of the most fitted, it’s not enough to explain some of the things we see in life. What else we need? Cooperation. is cooperation and evolution the key to life. Cooperation gives individuals a emergence power that they are not able to reach by themselves, and that in combination with evolution is what governs life.
To study this combination of evolution and cooperation, the correct tool is game theory, and that is what the book is about. Different experiments of game theory and how Nowak has been working on them and what he has found.
I think is a nice book and I learn quite a loot. Especially, I learn that a huge work has been done in this area, which was not know by me, and that interesting results has been developed.
I came across this video just a second ago. i think is interesting.
on of the most interesting part of the book is when it speaks about different games, and how rules can decide between better strategies. For isntance, if you play a game with other player and you decide to cheat and take advantage of him that strategy is going to work in the long term only if you never play again with him or if there is no way of new players to know about it. If you are supposed to encounter that player again or you reputation indicate you are a defector, then that strategy is terrible bad.
Hmmm maybe Nowak himself can explain this better.
I suggest to get a copy of the book and read it. It’s nice, its short and is written in a way accessible for all.
(And now I must prepare to my final test on the course, which is already on-line).












