Sierpiński and Pascal!
You just read those two words, what comes to mind?
Perhaps it's pressure, perhaps it's the triangle, or perhaps it's the triangular gasket... Doesn't matter, but I'm going to talk about how the two "triangles" relate to one another. Are they even related?
First of all, what is Pascal's triangle? It's a triangle full of numbers organized similar to bowling pins where each number in the triangle is the sum of the two directly above it. Here is an animation that shows this very well:
Perhaps it's pressure, perhaps it's the triangle, or perhaps it's the triangular gasket... Doesn't matter, but I'm going to talk about how the two "triangles" relate to one another. Are they even related?
First of all, what is Pascal's triangle? It's a triangle full of numbers organized similar to bowling pins where each number in the triangle is the sum of the two directly above it. Here is an animation that shows this very well:
Source: Wikipedia
This may seem familiar to those who love algebra, because the coefficients of the expansion of (x+y)^n is exactly the nth row of Pascal's triangle, with n starting form zero! Don't believe me? Try it: (x + y)^0 == 1 (x + y)^1 == 1 x + 1 y (x + y)^2 == 1 x^2 + 2 x y + 1 y^2 (x + y)^3 == 1 x^3 + 3 x^2 y + 3 x y^2 + 1 y^3 (x + y)^4 == 1 x^4 + 4 x^3 y + 6 x^2 y^2 + 4 x y^3 + 1 y^4 |
Seems weird, but that's a topic for another day. Even weirder is, these coefficients, or elements in the pascal triangle can actually be calculated without doing all the iterations, but simply with the "choose" function. Enough with Pascal for now.
Sierpinski triangle is a type of fractal containing infinite triangles. I'm sure most have seen it. Attractive isn't it? That's why it's also an "Attractive Fixed Set" (I lied, that's not why. But perhaps we can talk about this another day). A generic Sierpinski triangle looks like this:
Sierpinski triangle is a type of fractal containing infinite triangles. I'm sure most have seen it. Attractive isn't it? That's why it's also an "Attractive Fixed Set" (I lied, that's not why. But perhaps we can talk about this another day). A generic Sierpinski triangle looks like this:
Now here are some questions for you to think about: Are there more upright triangles (black ones) or are there more inverted triangles (white ones)? Are there even any upright triangles?
Well, that actually all depend on how you constructed the triangle in the first place, given that the number of iterations is finite. Today we're just looking at one of many ways this triangle can be constructed.
Cue Pascal.
Well, that actually all depend on how you constructed the triangle in the first place, given that the number of iterations is finite. Today we're just looking at one of many ways this triangle can be constructed.
Cue Pascal.
So here is how anyone can make a Sierpinski Triangle using Pascal's Triangle:
1) Make a large Pascal's triangle
2) Mark/Highlight/Circle all the odd numbers
And... that's it! What? Let me do it and see:
1) Make a large Pascal's triangle
2) Mark/Highlight/Circle all the odd numbers
And... that's it! What? Let me do it and see:
"Okay..." you say, "It sort of looks like the Sierpinski triangle, but it doesn't look nearly as good as the Sierpinski triangles I can find on Google Images!"
Well, yes. The idea is if you make an infinitely large Pascal's triangle and repeat the process, you will get the Sierpinski triangle, with all its detail!
To illustrate this, I wrote a program that generates a large Pascal's triangle (as big as your screen), and finds the remainder of each element as it divides by a set number N, and colors each pixel of the screen accordingly. In other words, if I set N = 2; I should, in theory, get the Sierpinski triangle I want:
Well, yes. The idea is if you make an infinitely large Pascal's triangle and repeat the process, you will get the Sierpinski triangle, with all its detail!
To illustrate this, I wrote a program that generates a large Pascal's triangle (as big as your screen), and finds the remainder of each element as it divides by a set number N, and colors each pixel of the screen accordingly. In other words, if I set N = 2; I should, in theory, get the Sierpinski triangle I want:
Well, that's pretty good! If you're like me, you'll be asking: "What if we divide by numbers other than 2? Would we get more cool shapes?!?" Of course, this is the reason why I wrote this program in the first place - to quickly draw shapes for us.
Note that we don't actually have to calculate the actual value of each cell in the pascal's triangle, and then mod (take the remainder of) it with N. Because of the fact that pascal's triangle rely on adding, and the gasket creation process only involves modding, we can transform the process into "rules".
Take N = 2 for example, we know that even + even = even, even + odd = odd, and odd + odd = even. The rule is apparent, assuming odd numbers are solid circles, and even numbers are empty circles, we get:
Note that we don't actually have to calculate the actual value of each cell in the pascal's triangle, and then mod (take the remainder of) it with N. Because of the fact that pascal's triangle rely on adding, and the gasket creation process only involves modding, we can transform the process into "rules".
Take N = 2 for example, we know that even + even = even, even + odd = odd, and odd + odd = even. The rule is apparent, assuming odd numbers are solid circles, and even numbers are empty circles, we get:
Pascal's triangle starts with a 1 on top, and the sides are also 1's, so simply draw black dots on two edges of the triangle, follow the above rule, you'll get Sierpinski triangle, without actually calculating the actual value of each cell. Similar rules can be used for other N's too. For example, if we use N = 3, the rules become:
With this rule, our gasket becomes:
Isn't it interesting that the triangle sort of looks like the Sierpinski triangle but not? Instead of having one inverted triangle within one upright triangle, this one has 3 inverted in each upright.
Now let's see what other triangles we get by using other N values, and assigning different colors for each different remainders!
Now let's see what other triangles we get by using other N values, and assigning different colors for each different remainders!
These images are so interesting to me, why these patterns? Why these shapes? Why does N = 14 look like it has a normal Sierpinski triangle embedded with random stuff? These are all questions for another time... But for now, you can play around with the program I wrote, plugging in different N values and looking at the shapes. Observe how shapes change when N is changed to a multiple of N...etc. Simply change the divisor value in the box and press enter and see it paint.
|
|
.Jar for run-able program, .java file for people who have too much time on their hands.
Last Updated: 7 May 2015
Last Updated: 7 May 2015