Swarm Intelligence

flock-birdsThink of a flock of birds. Bird flocks often demonstrate dazzling behaviors. They are breathtakingly beautiful, unpredictable, complex — but not if you look on a different scale.

In 1986 Craig Reynolds developed a little program named Boids (bird-oid objects) modeling the behavior of bird flocks. In the program, individual boids follow simple rules: they try to fly at the same speed as their neighbors, they fly towards the center of the flock, and they try not to bump into other boids. The pattern which his Boids program demonstrated was similar to that of a bird flock.


This property of emergence (simple rules leading to complex patterns) is observed in swarm intellegence, among many other things. An ant colony can achieve many great feats, but individual ants are very simple. There is no single ant in an ant colony that actually know what’s going on, whether the colony needs food, or whether they need to build something. Their actions are somewhat reflective of their neighbors. In this system of an ant colony, ants are not independent, nor totally dependent of each other; they are interdependent. It is this interdependency that allows them to achieve complex behaviors without knowing it.

Conway’s Game of Life


Here we have a game of life. The idea is that in a grid of cells, each cell is an individual life form, and it can be either dead (colored black) or alive (colored white). We start by assigning cells initial states: random cells will be dead and others will be alive. Then the cells’ next states will assigned according to their neighbors: if a certain number of their neighbors are alive, they will be alive; if not, they die. Then we let the game run and see what happens.


This game is named Conway’s game of life. It is an example of Cellular Automaton, which came about in mid 20th century. One of the origins of cellular automaton is the patterns on animals. Upon observing a cow one might ask: how do they manage to get such unique and complicated patterns? The idea is that simplicity can build to complexity. In Conway’s game of life, the rules are relatively simple — if neighbors live, cell lives; if not, cell dies — but the pattern it exhibits can be very complex. It’s simply that the rules and the patterns are not on different scales.

The idea that simple rules can lead to complex patterns on a larger scale is called Emergence, which we will discuss later.



The Corridor of Graphical Iterations


The “corridor” shown above is a little piece of generative art which I have created with Processing. It’s basically copying the idea of Graphical Iteration, but with colors.

So what is graphical iteration? It is a geometric tool used to analyze iterated functions. The iterated function which I used is x=ax(1-x), and the graph shown above has a=3.9969234. When we do graphical iterations, first we graph the function, for example, y=4x(1-x) and the line y=x.

Screen Shot 2015-03-11 at 7.43.16 PM

Then we take the original x value, plot it on the x axis, and make a line going from that point straight up meeting the curve of the function y=4x(1-x). From that meeting point, we make a line going across meeting the line y=x. Then we do another line going straight up meeting y=4x(1-x), then another one going across meeting y=x. We do that a bunch of times.

Screen Shot 2015-03-11 at 7.43.53 PM

Then we do that 20000 times.

Screen Shot 2015-03-11 at 7.44.09 PM

Then maybe we add some color.

Screen Shot 2015-03-11 at 7.41.22 PM

And that makes a “corridor”. But usually we don’t do graphical iterations for the sake of art, nor does the lines become all crazy like this. It only happens with certain values of a, like when a=4. You get different graphs with different values of a.





How do lunisolar calendars work?

I have recently discovered that the traditional Chinese calendar is a lunisolar calendar rather than a lunar one. Well, what even is a lunisolar calendar? You might wonder. It is a combination of a lunar calendar and a solar calendar. The “month” in the traditional Chinese calendar is equivalent to the length of a moon phase cycle, which is about 29.53 days. With 12 months in a year, that would make 29.53 x 12 = 354.36 days per year.


But, as we all know, a solar year is 365.24 days. It wouldn’t make sense for the ancient Chinese to use a pure lunar calendar, because they are an agricultural culture, and in that sense the sun is far more important than the moon. They would need something to deal with the difference between 354.36 days per year and 365.24 days per year. For that, they have “leap month”, which is an extra month located here and there on the calendar. There are 7 leap months in 19 years, because there are (19 x 12 + 7) x 29.53 =6939.55 days in 19 lunisolar years and 365.24 x 19= 6939.56 in 19 solar years.



How important is 2/3 to the Greeks?

I came across this interesting notion this week, that western music is greatly dependent on the fraction 2/3.

When Pythagoras was developing his scale, he first took a “monochord”, which basically is a piece of string with a specific length, and played a note with it. Then he took 2/3 of his monochord, and played another note, as shown in the picture below. Screen Shot 2015-01-25 at 9.04.15 PM

Interestingly, he found that note, played together with the first note, very pleasing, and thus named the relationship of the two pitches “perfect fifths”. The basics of western music, lies on the three chords: the first, the fourth and the fifth, which the fifth is the “perfect fifths” of the first and the first is the “perfect fifths” of the fourth. Therefore, the base of western music is simply bounded by the fraction 2/3, fancied by Pythagoras and the human ear.

Math at Putney

This is something that I’ve written about a year ago. I would like to share this with you, and to remind myself of why I decided to start the math club.

Before I came to study at Putney, I heard from my friends in a canoe tripping camp that it’s not cool to show that you love math in American schools. So when I came, I tried not to say so. To my surprise, people at Putney don’t feel that way. They treat you like equals no matter what you like, math or sports or instruments. Students enjoying math are not inferior. Unlike in Beijing, they are not superior either. I like this very much!

Putney also supports math through it’s math classes. Before I came here, I have never even thought about the possibility learning calculus at 10th grade, which I am doing now. The school gives you freedom in choosing the level of math course that suits your ability. I take my calculus class with mostly seniors, and it is a common phenomenon at Putney. In class, the teacher will also give some individual work. For example, when you did well on an exam, but the rest of the class didn’t, the teacher would give you a math related book to read on while the others go over the problems. There’s a lot of individual help. There are also opportunities to explore with math. Instead of final exams, we have project weeks when you can choose whatever topic you like, such as math, to work on. One student even built a tesla coil thing using physics.

Putney also gives you opportunities to take the lead in things you enjoy. When I came, I felt that we need a place for math lovers to get together, so I thought I’d start a math club. My advisor and math teachers are very supportive. I sent out emails to find students with similar thoughts, but unfortunately it was not very successful.  After a while, I made a presentation in front of the whole school, and this time, it worked!  Several students joined and we started to organize school math activities. We even set up a math club blog! I also use math to help others when a math teacher took me to help him do volunteering work by coaching the nearby public school students in math olympiad.  I feel that Putney gives me opportunities to hone my skills in leadership and it is great.