ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก
7.2: Wolfram Elementary Cellular Automata - The Nature of Code
ฝัง
- เผยแพร่เมื่อ 16 ส.ค. 2024
- This video covers the basics of Wolfram's elementary 1D cellular automaton.
(If I reference a link or project and it's not included in this description, please let me know!)
Read along: natureofcode.co...
A New Kind of Science: www.wolframscie...
Elementary Cellular Automaton: mathworld.wolfr...
github.com/shi...
Help us caption & translate this video!
amara.org/v/Qbvb/
📄 Code of Conduct: github.com/Cod...
I enjoyed this "stream of consciousness" style presentation and the "let`s have some fun with this great hobby" attitude. A nice refreshment after all the pompous, overstressed, getting a job oriented, "I`m better than others" programming videos that youtube is so full off. Your video took me back from the horrible "i have to program more or else" attitude that I got into, to "i want to program now!" joyful state.
So... THANK YOU!
"this is not my best video"
me : this is one of the best videos I've ever seen on youtube ^_^ .
keep going bro , you are amazing .
lol simp
hahah true, best train ride I've ever had with this video
Wanted to give some appreciation for the efforts you took to make these videos. We can tell you, like the average engineer, is probably a little awkward. Yet you're obviously doing your best to lighten things up. Thanks you.
I am learning all by myself and I gotta say that this is the explanation I want to see. Well done explaining this! I also like the enthusiasm. It feels like you're a friend discussing. Keep up the good work! :D
I'm so glad to hear, thank you!
No problem. Would you create more of these vids? I'm interested in 2D CA and I hope you'll create more videos about that.
Totally agree - the enthusiasm is infectious (in a very good non pandemic way) - this is great!!
shorter way to implement rules function would be:
int rules( int left, int me, int right ) {
int idx = 4*left + 2*me + right;
return ruleset[ 7 - idx ];
}
Yes!!!! 7 - idx This is the fix I needed for my code to agree with Wolfram's output. Thanks.
@@egregory314 Ah, you had your table upside-down!
You could use (left
@@greenaum For multiplication or division by powers of 2, a good compiler will optimize that to bit shifts anyway.
Got here because I picked up A New Kind of Science on a whim with very little prior knowledge, and I needed help visualizing how c.a. work. It makes me really happy to be able to learn from someone who clearly thinks the material is as exciting and fascinating as I do. It's nice to know I'm not the only one who gets passionate about how cool this stuff is, lol :) Thanks for the help!
That "if you're not too busy" comment around 7:30 really got me.
Extremely helpful for both my project and my understanding of this topic... This series of videos is truly amazing and you make it very interesting too. Whats more, in the last video you proposed some ways to apply c. a. and expand our knowledge on them. I appreciate your work very much.
14:27 "This is not my best video, but I'm gonna keep going" 😂😂😂😂😂😂😂
the framerate in the clip makes me dizzy.
It's better if you play at 0.75x
😻😻
I noticed that when you make your temporary array to calculate the next generation you're making a for loop to copy all the elements over. This works fine but Processing3 has a built-in function that does this for you. It's called arrayCopy. So you may replace your for loop with arrayCopy(gen, nextGen); or whatever you want to call your arrays. (The first parameter is copied into the second).
This was my introduction to CA and I found it very helpful for my understanding and very amazing results! Thanks!
Just love all this energy and passion! Makes the content a lot more engaging! Kudos!
16:45 For those asking for a way to quickly index, you may do a*2^2+b*2^1*c*2^0 = 4*a+2*b+c for this example (neighborhood=3 squares, base=2). This results in ::: return ruleset[4*a+2*b+c];
The only coding channel that I enjoy!
cocaine is hell of a drug.
But very good video!
+mushman05 hah. Thanks for the feedback.
@@TheCodingTrain I don't agree with that feedback. Good video all around!
You are a sad individual!
you could get double experience if you watch it in 2x
MATH. Not even once.
At 4:18, in a sense you were correct to say that you don't evolve generation 1, but rather compute it. However, there is a hidden accumulation of change (or potential change) over multiple cells in the production of generation 1, and any accumulation of change is evolution. Generation 2 is of course unmistakably evolved from generation 0 by way of generation 1.
18:30 The problem here is that this is not "complete randomness". Behaviour of automata is strictly determined, non-chaotic, and depends just on starting values. It doesn't even depend on random number generator, because.....there is ..... simply.....not present any random number generator in the code - just a set of rules. If you repeat your experiment milion times, up to a infinite number of iterations you'll get exactly the same results, depending just on 1. Set of rules, and 2. Starting values.
First let me say that I love your videos!
It took me a while to figure out the logic of Wolframs rulesets, but once it clicked now I'm hooked.
I am curious though. At 5:52 You made up a rule of (00101110) which is Wolframs ruleset #46. Ok, all is well in my mind, since 46 is the decimal equivalent of binary 00101110. But when I look at your code at 10:27 I got confused. This is because when I compare the decimal rule numbers in your code comments they don't correspond to Wolfram's rulesets. For example, 01111011 should be 123 not 222, since 222 has a binary equivalent of 11011110 . Can you explain this? Am I missing something?
-------------------
(edit) Never mind, I see now that they are backwards in your array. Example: the conjugate of ruleset = {0, 1, 1, 1, 1, 0, 1, 1} is 11011110.
-------------------
Thank You!
Great video! I just started my Algorithms & Complexity course, which features CA's and didn't quite understand the concept fully. Your videos are really helpful and also fun to watch, due to your enthusiasm! Keep it going!
+Daniel Shiffman would you please make another video about Elementary Cellular Automata ... you seem to understand it more than wolfram though.
+JL KL I'm hoping to get to remake some of these videos with higher quality and using JavaScript at some point!
I like how he just redid this video this year
And how rules work in the margins of the array where reference can be made only for 1 or 2 cells of the previous generation?
Thank you so much for making this video! Not only did you make the subject interesting to learn but your explanation finally made it click for me. Again, many thanks
Wonderful way of teaching. Plz provide a lecture how to implement irregular cellular automata
for people using processing, if you try to input ruleset in right way (github files need you to implement ruleset in reversed way) just make change in
CA file this way.
CA(int[] r) {
ruleset = reverse(r);
cols = width/w;
rows = height/w;
matrix = new int[cols][rows];
restart();
}
appreciate you taking the time out of work to give out free education, helps those that wont end up going into collegiate level stuff, but still want to learn
i also noticed you laughing at the quality, but i subbed just for this, it was super helpful!
It would be interesting to see what happens if you could change the rule set between generations. An oscillation between rule 30 and 110, something to that effect. I would imagine that the capacity for complexity would explode exponentially, especially if you determined the rule set by sampling eight consecutive cells from rule 30, each generation changing the rule set. This wouldn't be difficult to do with Python, thanks for the stimulating video!
I just found your channel and boooy i am addicted to it!
You are hilarious. I wish I had once a teacher half -- no, a quarter as fun as you are.
This has probably been commented upon already, but: niiiiiice choice of shirt for this video. Full marks.
Great vid, love the meta stuff, just crushing that 4th wall.
I did get some comprehension of ca I didn’t have before, thanx.
You probably know this by now, but wolfram alpha does use rule 30 as a pseudo random generator. Good intuition!
Hitting subscribe now.
Great explanation of CA, thanks man. And yeah, really like your teaching style :)
The best example ever of "being all over the place". Lol. Great lecture btw.
Very nice! I followed your example and did this today as well on my channel using MATLAB. Cellular Automata!!
I have more clue of how good he is coding everything than fps the video has
What if we make a loop of rules...
Line 1 -> rule 4,
line 2 -> rule 222,
L3 -> r134, and loop again.
With 2 rules looping you'll have 64k behaviours
.. or weight with sequences of primes, or add in rules the choice of which is determined by the previous line.. did you get anywhere with your suggestion? UK amateur here :)
14:04 "or previous videos" and the swag is amazing - thanks for the video!
14:30 "this is not my best video". maybe not, but the content is totally solid. take a breath man, slow by 10%, it's good stuff
You've inspired me. @12.17, you talk about a 2d grid that becomes a frame in a sequence of frames in an animation. How about -- rather than a 1d automata that becomes a 2d grid, how about a 1d grid of cells that's animated. OR how about a sequence of 2d grids, stacked one on top of the other to form a 3d shape. Then add a left-eye / right-eye projection and view it cross-eyed (or the other way). And then rotate it about any axis in the same way chemists might rotate a molecule in space. I wonder if that will yield new insights into the rule sets.
I've thought the same thing, I'd love to see how it would look in 3d
If stacked 1D CA generate emergent 2D patterns. Does a 2D CA generate 3D patterns when stacked in a lattice? Reminiscent of holographic principle?
"The holographic principle is a tenet of string theories and a supposed property of quantum gravity that states that the description of a volume of space can be thought of as encoded on a lower-dimensional boundary to the region"
Space and the dynamic things in it being an emergent 3D pattern. Which means we are already ghosts of some curious nature.
i actually did a random start of cells,
when u said try make one your self last video
and each cell calculates its value by saying
if(neigbor[x] == 1)
state = !state;
that the result
sure that gonna be some rule
like
01101001
that kinda xor
or rule 113
Advent of Code 2018 Day 12 uses similar ideas. It uses a 5 cell neighborhood.
5:22 :'-D
Excellent explanation though. I'm already familiar with CA's, and am learning python 3.0 to attempt philosophical in-silica experiments, just stumbled upon your video and am enjoying the side-info a lot. And your enthusiasm is contagious.
EDIT: 8:03, I'm slapping my knees.
How to calculate the cells on the edge? They have only two cells above them.
The beauty of complex(nondeterminism as a function of determinism) automatic evolutionary process happening in complex limits.
There is a lot of assumption that some of the results are completely random non-repeating, but I don't see any lines of code checking to see if any lines repeat.
Thanks for your wonderful lecture...
:) informative and fun! Best way to learn Thnx!
So glad to hear, thank you!
This man is perfect
nextgen[i] will skip 0 and cells.length because u start from 1 and end at cells.length - 1 which is logical but that will lead to undefined behavior cause nextgen[0] and nextgen[cell.length - 1] is uninitialized
I got a seashell with a rule 135 ish pattern on..... These exist in nature...
Hi. UK here. Good spot - me too. Follow your observation up.. :)
This guy loves his automata
What if I map my 1-dimensional CA onto the surface of a circle, and then I make every cell the same state: do they all cease to exist? What if my CA demands an intermediary state and-or translation?
Would it be forced oscilate?
What are some solutions to an edge case like this?
What if, instead of tracking each cell, we just scanned the entire image, gave each state a unique color, and then did a single gpu calculation on the entire frame, regardless of how many things are going on at once? [Because it would require the same number of computational steps, on every iteration of ths engine's loop]
@@niaschim sounds like a pixelation of sorts? UK amateur here.
Pretty interesting. Only it seems to be overly complicated. It's easier to understand but not at all resource friendly.
Note: I''m used to write for micro controllers with 2k ROM and 256B of RAM.
My approach:
I would replace the array for a single n bit value.
1. Mask the bits i need to compute the next generation.
2. Lookup the next value of the cell.
3. Repeat 1,2 for the binary length
There are some tricks like making a struct or array of binairy numbers. (saved as one int)
Hi! I know this video is quite old but I was trying to create a wolfram elementary simulator in python, but I ran into a problem, which is handling edges.
What am I supposed to do with the edges of the grid, since I can't make the grid infinite? If I simply try to request the next cell of the last, I get an index error.
There are two ways edges are usually handled. You either set a fixed boundary condition or you wrap the boundaries like a pac-man game.
Great video! Very easy to follow and entertaining. There is a thing I don't understand. If gen0 is an array filled with 0, for any ruleset where 0,0,0 = 0, how does anything at all happen?
CA is amaaaaazing!! And thx for the video!
I only wonder how you get the left index of cell[0](or the right for cell[cells.length-1]) without a boundary constraint(and more important not causing an index out of range on the array itself)? Does it wrap around? Is it always 0, or 1? Don't see it in the code. Boring question but still..
Great video! Really enjoyed your way of explaining the topic. Keep it up I just subed!
yay, thank you!
12:50 I think it is "Repetition"
8:00 What about border values? Do we "wrap" all the array, so -1 index becomes n, and (n+1) becomes zero index? Or we make special rules just for one neighbour at the border?
Hey man these videos are awesome. This one's really old so I don't know how you do them now, but they're way better than you say! Though even then, you say it in a relaxed, more human way so not annoying self deprecation.
That aside, I'm gonna take a guess and say that the fractal rule counts as complexity since in a way applying the same rule in each iteration is repetition, regardless of what rule it is. I hope it's not silly-level wrong, I'll find out!
Very helpful, and fun tut! Thanks :)
and now to the question, that everybody here craves to ask but is afraid that it will open a pandora's box..
how to we handle the left most and the right most cells, hah? ;p
examining your generate function i noticed, that you simply let them remain unchanged, treating them as what i believe are called a shadow cells: the cells that serve as a source of information for their neighbors, but do not constitute as an actual cells themselves.
and this is great, don't get me wrong. but i just wonder whether new interesting, never-seen-before patterns couldn't have emerged if we've linked the right most cell with the left most one instead (i.e. by treating our grid like a circle and not like a segment).
you just give them a default value. wether 0 or 1
actually the left and rightmost cells are being used the generational algorithm displays top down and you can see the wave outward from the middle cell because in this particular cellular automaton they always start with 1 singular cell in the middle preactivated. The outcome depends on the particular rule as well as the starting world (Which the latter was controlled for this demonstration; always 1 cell preactivated in the same location in GEN1).
the tape is infinite in both directions i believe
Like space invaders?.. you could certainly join the left and right edges to form a tube, then the tube rims to form a doughnut..
I have a question which is about on video 6.22, he say 000 represent 0, 001 represent 0, 010 represent 1 and .... so on. Why 000 is represent to 0 , can it become 1? or it just user to random define which mean that we can defined 000 as zero or one both is accepted?
love it - interesting and made me laugh out loud! thanks
Thank you for that great Lesson :-) !
Thanks for watching!
Hey @coding train great video! I’m currently a computer science student tasked with creating a python program (rule_110(x,y)) where x is “width” or number of cells and y is the number of generations/time steps. This helped in understanding CAs in general, but is there way to modify the code such that it prints characters versus programming an image? Also, how does one program in python so that it computes the next generation but still maintains the values from the previous generation?
repetition is naturally occuring when it comes to true randomness
Wtf "true randomness" doesnt exist, just because we cant predict when/where/how its going to happen
i have no idea what each of these words mean separately or as a whole but they sounds so fucking cool that I had to see whats this about
Gotta love that retro Dan enegy :)
Hocam bizi nerelere attınız ya. Adam kokain çekip gelmiş herhalde. CS223 projesini bitirmenin sırrı bu mu yoksa?
what will be the right neighbour cell(or precisely the array index) of the last cell in the array?
What about cells that don't have two neighbors? Such as the left-most and the right-most ones.
you can deal with cells on the "borders" in two ways: 1) you assign a different neighborhood or 2) you wrap the borders around. For the first case, instead of having a 3-neighborhood (the central cell, the one on the left, the one on the right) you could use a 2-neighborhood (the cell itself and the immediate neighbor) for the leftmost and rightmost cell, since obviously there's only one cell adjacent to the cell on the border.
However, usually the second solution is used: imagine that the "strip" of cells is made into a ring, by gluing together the leftmost cell and rightmost one. Now these two cells can have a 3-neighborhood.
Just for clarification: let's say that we have four cells,which are labeled A-B-C-D. For B, the neighborhood is A-B-C. For C, is B-C-D. If you bend the strip into a ring, now A is close to D, so the neighborhood of A becomes D-A-B, and the n.b. for D becomes C-D-A. Makes sense?
Yes, very much so, thank you. The alternative is to just assign cell -1 and n a fixed value, right?
fabse64 ah yes, this is another option that I forgot!
Great answers!
Daniel Shiffman thank you very much :D Great video, by the way!
At 13:00 it looks like you did your binary math a little off. The right most bit represents 1, not 2. You were just shifted by one place that’s all. So 0101 would be 5, not 10 for example.
@17:43 Isn't repetition a necessary part of complexity?
Are Wolfram's Rulsesets also working for 1D Cell automatons with 1 or 2 Cells?
I'm not sure exactly what you mean, but you can see all the rulesets for 1D CAs here: mathworld.wolfram.com/ElementaryCellularAutomaton.html
Thank you for the Link :-) ! I also read this chapter natureofcode.com/book/chapter-7-cellular-automata/ of your book, because i did not understood the concept of the automatons fully. But after your video and the chapter of your book, things are now much more clearer :-) .
I wonder how this dude would look like on high caffeine amounts and a nice dosis of not sleeping huehuehue
Warning: in 2 years time you are going to fall of your bike.
Your comment haunts me to this day. I'm still waiting.
jokes on you. I never ride a bike
success you were correct
Ok what how did you know
Oh man I should have studied pure mathematics.
You are showing the work of Claude Shannon.
Can’t tell if he’s excited or recasted
Was going to say devastated but I think recasted is randomly interesting
So we start with a single cell. then with a rule set in binary up to 256 changes the cells below it?
I'm gonna program this
I remember writing this, I did well programming it
i argue fractal is not complexity if obvious to the eye its a "slowest path of simple to complexity lol" if it is infinite complexity
What if we dó calculate with one state?
i like how rule 34 is just a stick
wow - this is so profound
I'm at least close to the truth when I believe that from a few simple rules (charge, spin, and attraction, aka the electromagnetic force, the 2 nuclear forces, and the gravitational force) complexity arises. Witness: the world in which we live. :)
Thanks Daniel, ,,,I have one question please, how we compute the transition rules?
+Husam Atallah This is described here: natureofcode.com/book/chapter-7-cellular-automata/
Amazing.
can we use CA for solve differential equation. Like finite difference or FEM. for example I wanna solve 2D Laplace equation with some boundary.
interesting idea! definitely worth exploring.
its mean there is not any application like that
how do you get the screen to follow the animation down the screen?
I've been thinking the same thing
Maybe he translates the axis a distance equal to the height of a new row
6:37 rule 46
This is great, thank you
thank you so much
17:31, could use KMAPS
Great video
Amazing video :)
could u please tell whether u r using open gl to execute the above code or something else?
He's using Processing in this video. Check out his other videos if you want to learn more about it.
How u find rule set plz explain