
The Sierpinski triangle page to end most Sierpinski triangle pages - pr_fancycorn
http://www.oftenpaper.net/sierpinski.htm
======
hansjorg
That's amazing. It just goes on and on with beautiful plots. About halfway
down, there's a section on understanding the Riemann sphere:

> From what I can tell, one of the settings used to deal with division by 0 is
> the so-called Riemann sphere, which is where we take a space shuttle and use
> it to fly over and drop a cow on top of a biodome, and then have the cow
> indiscriminately fire laser beams at the grass inside and around the
> biodome. That's my intuitive understanding of it anyway.

And there's even animation (with Mathematica source) for this one. However:

> (Note the cow cannot be spherical or it will roll off).

~~~
pflats
I'll attempt a layman's explanation of a Riemann sphere for anyone who has no
idea what this is about:

The Riemann sphere lets you deal with dividing by 0 by adding one more point
to the complex plane: ∞[1]. Imagine putting it in the air above the origin, 0,
and folding the midpoints of the four sides of your graph paper to meet there.
(Yup, put all 4 points of the arrows in the same spot!) That's the Reimann
sphere[2].

Going from a point the sphere back to the plane is a little weird.

1\. Put a cow (point) on the top of the biodome (sphere) at infinity.

2\. Pick the point on the sphere that you want to give a home on the complex
plane.

3\. Have the cow fire a laser beam (draw a line from infinity) through the
point.

4\. Follow that line back to wherever it hits the plane. That's the equivalent
point on your complex plane.

Play with this a bit. Points near the top of the sphere (near the cow, at
infinity) will shoot laser beams way off into the distance. Points near the
bottom of the sphere will burn the grass right nearby on the plane itself.

You can then reverse the process ("If my cow were to shoot a laser at this
grass, what part of the the biodome will get hit?"), to go from the plane to
the sphere, because "folding up the sides of paper" doesn't accurately model
what happened to make the sphere.

[1] Math with ∞ is what you'd expect: 3/0 = ∞. 3/∞ = 0.

[2] Since there is an infinite number of points on a sphere, this is entirely
possible, and only mildly unsettling.

~~~
Camillo
That sounds similar to the projective space used in computer vision.

~~~
xyzzyz
Maybe it's because Riemann sphere is nothing else but a complex projective
line, but I guess the reason you feel they're related is that both of these
are manifolds which are created by performing certain identifications of
points inside flat prototypes.

------
Groxx
Uh, wow, I think they earned that claim. There's so much in here, they even
have a cow which fires lasers being dropped from a space shuttle.
[http://www.oftenpaper.net/img/understandingtheriemannsphere....](http://www.oftenpaper.net/img/understandingtheriemannsphere.gif)

seriously going to have to look more closely at this some time, it's
fascinating in a "look what you can do with math/programming/mathematica" kind
of way.

~~~
crisnoble
"This cow does not cower. Infinity cannot bully this bull, cannot bloviate
this bovine. By all appearances this cow is wearing infinity on its mane."

------
taliesinb
For those who happen to have Mathematica, try this to get a smooth, high-
resolution interactive fractal explorer (make sure you have a C compiler
installed):

    
    
      JuliaFP = Compile[
        {{const,_Complex}, {init,_Complex}}, 
        Module[{val=init,n=0},
          While[Abs[val] < 5 && n < 25, val = val^2 + const; n++];
          {Mod[Arg[val]/(2*3.14159), 1], 1 - Abs[val]/5, 1 - Abs[val]/100}
        ],
        CompilationTarget -> "C", 
        RuntimeAttributes -> Listable, 
        RuntimeOptions -> "Speed"
      ];
      
      {fine, coarse} = Table[Complex[j,i], 
        {dx, {0.008, 0.002}}, {i,-1.5,1.5,dx}, {j,-1.5,1.5,dx}
      ];
    
      pt = {0.0,0.0};
      Graphics[{
        Raster[
          JuliaFP[Complex @@ pt/2, If[ControlActive[], fine, coarse]], 
          {{-2.0,-2.0}, {2.0,2.0}}, 
          ColorFunction-> Hue
        ],
        Locator[Dynamic[pt]]},
        ImageSize -> 800
      ] // Dynamic
    

P.S. Original post is awesome. I love the cow!

~~~
e12e
Thank you for this. I tried looking around for the "best fit" for a
Mathematica work-alike that is Free software, but came up somewhat short. The
closest I could find was Gnu mathics, but it doesn't appear to be very
complete (ie: many Mathematica examples won't work). Other alternatives are
SAGE and of course Julia -- and I guess SAGE would be the best for "playing"
or "live coding"?

Anyone have any insights?

I'll also note that Mathematica looks quite awesome indeed.

~~~
ihnorton
One of the Julia creators did a fractal demo [1] recently, including the
Sierpinski triangle. Julia is now quite nice for interactive work via the
IJulia notebook (IPython kernel for Julia). As a bonus, it does not require a
C compiler to get good performance.

[1]
[http://nbviewer.ipython.org/url/beowulf.csail.mit.edu/18.337...](http://nbviewer.ipython.org/url/beowulf.csail.mit.edu/18.337/fractals.ipynb)

~~~
taliesinb
IPython is catching up with the Mathematica frontend, slowly but surely. And
that Julia demo is nice -- though I don't think a procedural language like
MATLAB is the best model for a scientific language in this day and age.

We (Wolfram) are working on a web frontend for the Wolfram Language that will
make the language "effectively" open, even if it is still proprietary.

And after the next version, we're going to be concentrating hard on defining a
typed subset of the language that can compile via LLVM to all kinds of
targets, including the browser.

~~~
StefanKarpinski
It's tough to catch up with Mathematica when you guys keep putting out such
awesome stuff with each new version. It's been great to see Wolfram innovate
so much – versions 6, 7, 8 and 9 were all amazing releases (especially after
the four-year gap following 5). I found the new symbolic discrete calculus
work in 7 and the symbolic statistics capabilities that built on that in 8 to
be particularly mind blowing [1][2]. This seems like it was the fruit of a
focused, long-term R&D agenda.

Regarding Julia, although the syntax is superficially similar to Matlab and
we've intentionally made many things compatible, Julia isn't really modeled on
Matlab. Julia is much more influenced by Lisp – much like Mathematica via
Macsyma and Maclisp. Julia's dynamic multiple dispatch is somewhat reminiscent
of Mathematica's pattern matching dispatch system too, although, of course,
the evaluation semantics are radically different.

I hate to quibble, but having a web frontend for Mathematica that you don't
charge people to use does not make it "effectively" open. Mathematica is a
shining example of excellence in closed-source software and I have no problem
with it as such, but calling it "open" because there is a web version is just
disingenuous b.s.

[1]
[http://www.wolfram.com/products/mathematica/newin7/content/D...](http://www.wolfram.com/products/mathematica/newin7/content/DiscreteCalculus/)

[2] [http://www.wolfram.com/mathematica/new-in-8/probability-
and-...](http://www.wolfram.com/mathematica/new-in-8/probability-and-
statistics-solvers-and-properties/)

------
nilkn
Another cool thing about the Sierpinski gasket is that it's possible to more
or less do calculus on it. You can even define a Laplacian operator. There's
actually a whole class of fractal-like sets on which this is possible, but SG
has always been the prototypical one.

~~~
X4
I also thought about implementing a language that bases on this, a language
that sees the world in all it's shapes as raw numbers, a matrix, renderable as
graphs. This is so freaking awesome, that I cannot stop thinking about the
crazy new ideas this injected into me and suspect that I'm probably becoming a
numberphile.

Interestingly, I was just reading the Book (hardcover) with the recursive
Title: "The Fractal Geometry of Nature" by Benoit Mandelbrot. And this brings
an entirely new meaning into my world view after combining the ideas behind
this and
[http://en.wikipedia.org/wiki/Multifractal_analysis#technique...](http://en.wikipedia.org/wiki/Multifractal_analysis#techniques)

------
BenoitEssiambre
That is truly impressive and mostly all over my head. I feel that somewhere on
that page we should be able to find a graphical solution to the factorization
of large primes unless maybe that code would need to run on a computer
residing in the fourth or fifth dimension?

~~~
xerophtye
>That is truly impressive and mostly all over my head. Glad i am not alone

------
wfn
Holy mother, this person is cool and this person's website is cool, too:
[http://www.oftenpaper.net/](http://www.oftenpaper.net/) (it even has an
article on Arc coroutines, ha!)

~~~
gknoy
I especially like the way they present images + source as annotations in their
article.

------
bcbrown
So cool. Fractals were the thing that got me into high-level math and
programming, back in high school. One of these days I'm going to go re-
implement a bunch of the fractal-generation algorithms.

------
1wheel
Not nearly as comprehensive, but interactive w/ d3:

[http://roadtolarissa.com/triangles](http://roadtolarissa.com/triangles)

Only a couple of lines of codes too:

[https://github.com/1wheel/BizarreSierpinskiTriangle/blob/mas...](https://github.com/1wheel/BizarreSierpinskiTriangle/blob/master/triangle.js)

~~~
coryfklein
s/a couple of/59

------
8_hours_ago
Is is just me or is the code source really hard to understand? It's cool that
you can represent such complex shapes with just a few lines of code in
Mathmatica, but without comments and with all the single letter variables,
it's hard for me to follow what's going on.

~~~
pflats
I agree, but do realize this is written for a mathematical audience, not a CS
audience. It's reductive, but it's not _that_ reductive to your average math
major/grad student.

Code by/for mathematicians is particularly ugly to a professional programmer.
There is significant historical (pencil & paper) precedent for what single-
letter variables represent in a given context. For a mathematician,
ConstantArray[0, {m,n}] reads more cleanly than ConstantArray[0, {cols,rows}].

Similarly, seeing variables like p1, p2, p3 is off-putting to me as a
programmer, but I still immediately recognize them as 3 arbitrary points in a
triangle.

~~~
8_hours_ago
That makes sense; I'm not the target audience. It was just a little off-
putting to see some code and think "Whoa! That reminds me of Perl golf!!".

------
eigenvalue
This is amazingly cool and stimulating to think about. It's also a compelling
reason to take another look at Mathematica. The code is clearly dense and hard
to understand, but I wouldn't even know how to go about performing some of
these computations in another language.

~~~
sbrother
I really wish the licensing for Mathematica weren't as strict; it's a
fantastic language that would be everywhere if it had a free "community
version" or something. I used it very extensively in college and then took
advantage of the $500 lifetime professional upgrade for new graduates. Now I
do server-side development and data science at a startup, and I often work on
problems that could solved efficiently with a few lines of Mathematica code.
I'll use it for one-time internal scripts, but due to Wolfram's licensing you
can't just bake it into your server code. Not to mention, it's nearly
impossible to find engineers who have much experience with it since you can't
exactly download it and hack on it like you can with the alternatives.

Don't get me wrong, it's a powerful tool and well worth it's price. But
adoption is extremely low outside of academia, and I don't see that changing
anytime soon unless Wolfram adopts more developer-friendly licensing. Which is
a pity because it's definitely the "right tool for the job" in a lot of cases.

------
vanderZwan
A few years ago, I accidentally found this way of creating a Sierpinski
Gasket-like structure:

[https://vimeo.com/7690310](https://vimeo.com/7690310)

Lines "flow" from left to right (horizontally) or bottom to top (vertically),
and all lines start out white. When two lines cross, they might switch color
depending on which color they come across, as follows:

* white (h) + white (v) = black (h) + black (v)

* black (h) + black (v) = black (h) + black (v)

* white (h) + black (v) = white (h) + white (v)

* black (h) + white (v) = white (h) + white (v)

~~~
simcop2387
What you've got there is a truth table for the XOR bitwise operation.

    
    
        HV | O
        ---+---
        11 | 0
        00 | 0
        10 | 1
        01 | 1
    

You can do it very similarly with the coordinates of the pixels on the
screen[1]. It's really interesting how often that shape comes out of places.
Which is why I think that this page got started.

[1]
[http://www.stilldreamer.com/mathematics/sierpinskis_triangle...](http://www.stilldreamer.com/mathematics/sierpinskis_triangle/)

~~~
pleion
I designed a system of cellular automata based around this idea of colliding
lines. You can play with it at
[http://sciencevsmagic.net/logicgrid](http://sciencevsmagic.net/logicgrid)

The XOR Sierpinksi's triangle is at
[http://sciencevsmagic.net/logicgrid/#282800](http://sciencevsmagic.net/logicgrid/#282800)
but there are other ways make it too. For example XNOR makes an inverse
[http://sciencevsmagic.net/logicgrid/#828200](http://sciencevsmagic.net/logicgrid/#828200)

If you keep hitting random you'll find plenty of surprising analogues to
Sierpinksi's.

------
hendekagon
Totally amazing...it is itself a fractal of information, I want to go into a
recursion of link-following!

Can't resist posting my Clojure implementation of the chaos game:
[https://github.com/Hendekagon/card](https://github.com/Hendekagon/card)

------
RockofStrength
I was thinking about Sierpinski triangles recently, and trying to relate it to
the 3 4 5 triangle. The 3 side has a Sierpinski triangle, with 9 segments,
equaling 3^2. The 4 side has an equivalent "Sierpinski square", with 16
segments, equaling 4^2 (basically four squares touching at the corners with an
empty square space in the middle, forming a cross shape). Then I was going to
show how the two shapes could be combined to equal 5^2, or come up with its
own shape (a house seems best, as the regular pentagon tiles the plane so the
line totals don't work out).

As of yet, fruitless. It's a cute little project that shades of the standard
presentation of three squares forming a center 3 4 5 triangle, with an
interesting twist.

~~~
judk
Regular Pentagon does not tile the plane.

~~~
RockofStrength
[http://i.stack.imgur.com/bGpfy.png](http://i.stack.imgur.com/bGpfy.png)
You're right, thanks. So if the inner space is shaded, it produces the
"Sierpinski pentagon", and this can be iterated indefinitely.

------
8iterations
I was going to say not all Sierpinski pages, because I didn't expect to cover
CGR with genomes. But it covers it! My version:
[http://8iterations.in/cgr_hanako](http://8iterations.in/cgr_hanako)

------
interstitial
He also mentions Lisp several times in his blog. That alone would rate a front
page mention on HN. But seriously, what a wonderful smile-inducing website and
page.

------
spot
[http://draves.org/pix/frame3.cgi?zoom=1&dir=flames&file=205....](http://draves.org/pix/frame3.cgi?zoom=1&dir=flames&file=205.jpg)

one he missed, from the early 90s

~~~
GhotiFish
He did not. Fractal Flam3's are the chaos game.

to quote:

    
    
      1 start at any point. call it p
      2 pick one of the three vertices at random
      3 find the point halfway between p and that vertex
      4 call that point p and draw it
      5 goto 2
    

He goes into great depth about this strategy.

~~~
spot
i don't mean flames in general, i mean that particular image, which is a
spherical version of the sierpinski with rotation.

------
EpiMath
I've just spent the last hour or so at this site ( found via reddit/math ) and
it is pretty amazing. Well worth a look! Also the link at the end to mathics
was new to me and looks interesting.

------
bhouston
Did some Sierpinksi triangles for TOH a few years back:
[http://www.exocortex.org/toh/](http://www.exocortex.org/toh/)

------
chmod775
Triforce spotted :)

Nice to come across some fellow Zelda fanboys unexpectedly.

------
bonemachine
Just about ended my Chrome session, until I killed the tab.

------
brainburn
29 bytes sierpinski:
[http://www.pouet.net/prod.php?which=4856](http://www.pouet.net/prod.php?which=4856)

------
axyjo
2b ∨ ¬2b

Clever.

------
pertinhower
Well, I suppose this is a decent _start_... ;-)

------
liotier
Gonzo mathematics !

------
mrcactu5
At least the guy's enthusiastic

------
Gregorein
One fractal to bind them all…

