Welcome back.
I just wanna make another short video
about Solar Automata showing you an example of a code
that we developed in a life coding experiment
in the last edition of modeling complex systems.
Hopefully we'll have some times to do interactions
like this as well.
So let me share my workstation with you.
So you should now be seeing a beautiful painting
by Marc-Aurele Fortin,
which is my usual background.
Let me just bring this over.
So as I said, this is a life coding exercise
that was done with the group
from modeling complex systems in the fall of 2019.
Someone in the group was interested in modeling the spread
of different words for different things.
So essentially,
here we were looking at soft drinks, which I call, liquor
and in the US people will call soft drinks tonic apparently?
That's one Coke, soda or pop which I also like.
And then we want to know
how might these different terms
for the same thing spread spatially.
So we're gonna do a CA, where we're gonna be thinking
about every spot as a household
like a family that could live somewhere.
And we're gonna say
that when a family adopts a language, it keeps it forever.
But when a new family emerges
it will adopt the language of the local majority.
So we will be starting
with uniform or adult initial conditions.
That's our initialization.
So it's still a grid 256 by 256.
Our population initially is a bunch of zeros.
Then I have some figure color scheme elements here as well.
I'm gonna be observing.
And that's the O part of our I O U.
I'm gonna be observing the number of zeros
the number of one, twos, three, and four.
So remember those are my five discrete states.
Actually there is six 'cause there will be available houses.
But what these numbers represent is zero for pop
one for soda, two for Coke
three for tonic and four for soft drink.
I like keeping a dictionary
of what the integer values mean
in terms of the model states.
Then we'll have a stochastic process.
So we're gonna say that our discrete time unit is a decade.
Family moves once a decade.
Actually what it moves is just a death process.
We remove that family
from the system and it's gonna be a unoccupied house.
So that's a sixth state in the system
which I believe will be given the state minus one.
So let me just note that down.
Have all houses have state minus one.
Then there will be a birth rate
which will fix to one but won't always be used.
There is a hipster effect that was introduced late.
Once you have a model, that's the fun thing you can
you can play with very different mechanisms
but I won't use the hipster effect for now.
This was just houses that thought they were cool and instead
of adopting the language of the majority would just
picked whatever is the least popular term going around.
And then for every time step, what we're gonna do
and here I'm using mesh tool notation to make it
a little faster for MATLAB.
So I'm drawing N by N.
So for every house in my system, I'm drawing a random number
and I get a matrix of random numbers.
If at a given location that random number is smaller
than death, so smaller than 0.1, my death parameter
then I set the value of that cell to minus one.
So in one line, I'm essentially going
over every cell, drawing a random number
between zero and one.
If it's smaller than my death probability,
I assign that cell a value of minus one.
Then for every cell what these crazy lines are doing
is looking at neighbors.
Let's see, below them, to the right.
What is this?
To the left and above
Yes, to the left and I'm, I'm getting confused
but this is what these are doing here.
The second dimension is in MATLAB is the row.
So this would be, this would be to the left.
And here we have, we have periodic boundaries
which is what I wanted to point out.
So we look at to the left, we look at to the right
and below and above and again periodic boundaries.
Okay? So we look everywhere and we count the number
of neighbors in every cell that are equal
to 0, 1, 2, 3, and four.
So we now have five matrices that tell us
for every cell how many neighbors
in this four neighborhood are in a given state.
And then if that cell is currently unoccupied, then we
we pick this.
This is like a bad way to code it up,
but this is all life coding.
This was all done with the students life
and this is how we did it.
So then if you're available to be repopulated
you're populated by whatever is the majority.
Note that there are no like greater than or equality
which means that if there is a tie, you stay unavailable
an undecided family until the tie is broken.
And then we're gonna plot two things.
We're gonna plot the numbers
of zeroes, one, two, threes, and four.
And we're gonna plot the state of the system.
So we have the evolving number of
zeros, one, two, three, and fours
and the state of the system in the bottom figure here.
So I've assigned them all a color
I've chosen a little psychedelic camo color scheme
and I'm letting the system evolve.
Know that I start with random initial condition.
I have a big system, they all start, you know
close together and yet sometimes they can cross.
So green, which is my number of fours
which means people using soft drinks was initially,
at some point lower than reds, which is my number of zeros.
So people using pop.
So I'm a big fan of pop
but it got overtaken through stochastic effect
or through geometrical effect in the structure,
got overtaken by soft drink.
And now it decays
And it seems like some of them, yellow and blue
which are respectively threes and ones meaning tonic
and soda are getting real popular here.
And then what's going on here at in the bottom is
that we're sort of stabilizing around neighborhoods.
Neighborhoods that use a fixed language.
Even though we started with a complete mess, right?
And I can start this, I'm drawing new values here
like look how much of a mess it started
with and then it's self-organized
into sort of stable neighborhood.
Okay?
I will go back to the code and put back that hipster rule.
So remember what the hipster rule is saying is
that with small value, one in a percent of new family
if there are hipsters and we're saying
that if everyone, oh actually okay, I couldn't remember.
The hipster mechanism means that with a small value
if you're currently saying a word
and all your neighbors are saying the same word
you just switch and you switch to the coolest value.
And the coolest value is just the most rare value, right?
So real hipsters, I'm gonna bring back my figures here
figure one at the bottom
and now I'm gonna run it with this hipster mechanism.
And usually what a hipster mechanism
like this does is stabilize any initial inequalities
or any geometrical inequalities and help like make sure
that no one term or
or no strategy or no collar takes over the others.
So now they're all getting really close to 20%
which is perfect split.
We're just below 20% because
at any given time there are some unoccupied houses.
So sales in the minus one state
but we're still getting this neighborhood effect
just people's changing randomly and stabilizing the system.
Okay.
The last thing I wanna show you is
that this model was made a little complicated
at first, sort of by design students.
I mean we had a diverse group
and people had a lot of words in mind.
I'm still not sure
that tonic is a word for soft drink, but it was mentioned.
One thing we can do is say
really the only common ones are soda and coke.
So pop is very cool, but not that common around here.
Tonic, never heard that in my life.
Soft drink sounds like an old person, which is fine.
So we're just gonna put the birds of those terms to zero.
And for this I'll remove the hipster rule again.
Basically what I want is for pop, tonic
and soft drinks to be phased out of the population quickly.
They won't come back.
And really we just want to look
at the interplay between soda and coke.
So two terms, two colors only.
So we start with a lot of colors
but we end up with just green and blue.
This is a nice mix.
Obviously I made a mistake
and I haven't matched my colors correctly.
So I'm not sure which color black
and the top figure refers to versus the bottom figure.
Well what's very cool is that we find this stripe
pattern that emerges any set, any island.
So like this green island
and the blue sea are slowly getting eroded.
Similarly, blue island
and a green sea are getting eroded and disappearing.
And what we're gonna be left with is just continuous patches
of green, why continuous patches of green?
Because we have created boundaries
and one continuous patch of blue.
So the model we ended up creating sort of
accidentally to model something fun
like the spread of words to describe soft drinks.
We ended up like creating a model that would be
cool to explain something like patterns on a leopards
or something like creates interesting patterns and
and that's one of the things we'll see time
and time again is this course is
that once you get an intuition for what modeling does what
this wasn't purely coincidental, I can like
guide the class to like rediscover classic models.
Maybe they were invented in the context
of evolutionary biology and pattern formation
but we can rediscover them
in the context of soft drinks and funny words.
So if you have any question about this model
or if you want to get access to this code, just let me know.
I'll be happy to just share it
with anyone and hopefully we can play around
with some models on our own and start brainstorming
about other cool things to do with these cellular cataratas.
I'll see you soon in discussion groups.
Bye.