Message Boards Message Boards

23
|
24213 Views
|
6 Replies
|
52 Total Likes
View groups...
Share
Share this post:

The Sierpinski Triangle page to end most Sierpinski Triangle pages

Posted 12 years ago
I must confess I hardly ever doubted that if there exists a “Sierpinski Triangle page to end most Sierpinski Triangle pages” it would be written with help of Mathematica. These 10 quoted words is how Antonio Marquez-Raygoza titled his recent blog article. That did sound intriguing and I must assure you, in my opinion, it lives up completely to the title. Knowing Antonio as an author of two exquisite Demonstrations and as a skillful Mathematica programmer with a fine taste for visual design and elegance, I put everything aside and started reading. And was it a feast for my eyes! Some of you may know me as a person who enjoys coding visually appealing graphics. So imagine my joy in encountering something like this beautiful image and discovering it was produced with just a few lines of code (like so many things in Mathematica):
draw[v_, df_, n_] := Module[{ring}, ring[c_, r_, depth_] := Module[{ps}, ps = c + r {Cos[#], Sin[#]} & /@ (2. Pi Range[v]/v);
     If[depth == 0, Polygon[ps], ring[(c + #)/2, df[0, r], depth - 1] & /@ ps]];
   Graphics[{EdgeForm[White], Opacity[.4], RGBColor[.4, 1, 1], ring[0., 1., n]}]];

Show[(*repeatedly draw to cover more possibilities*) draw[4, (#1 + #2)/RandomChoice[Prime[Range[4]]] &,
    RandomChoice[{.1, 1.5} -> {2, 3}]] & /@ Range[20], Background -> Black, ImageSize -> 600]



The article produced a massive viral hurricane of event on Internet. Let me share a few bits I picked up in the aftermath.This post mad quite a boom on Reddit getting front-paged on several sub-Reddits:
It was also posted on a few other Reddits. The article also scored 327 points and 55 comments on Hacker News a.k.a. Ycombinator.

There was of course an ocean of tweets, Facebook posts, and other social media sharing. I was very happy to see such famous Twitter feeds as Topology Fact sharing the link to the article:



This is an impact report of only tweets containing exact title of the article, of course they were many more tweets with different content:



And I must acknowledge the jazzy frisky humor of the piece – not once it made me smile in amazement or simply LOL. For example a quote: 
Note the cow cannot be spherical or it will roll off.
was also posted on Reddit in comments and earned more than 100 voteups! But it is not just funny - if you are not a physicist you probably will miss that this is most probably a reference to the spherical cow joke. I do not want to give you any spoilers but the poetic cow part with phrases like
I think this is the first time I'm jealous of a cow.
is actually about built in Mathematica cow that can be accessed simply as
ExampleData[{"Geometry3D", "Cow"}]
and with some further brilliant codding you will get this and agree eventually that a spherical cow would indeed roll off:



Sometimes on a book cover one may find quotes from critics acclaiming the book. I think what critics to a book, Reddit and Hacker News are to a blog. This is why I would like to post here just a few URL-linked comments from Reddit and Hacker News discussions of the post as my small token of appreciation for the fascinating reading.

Below I show a few images from that blog as a teaser. For complete visually unforgettable and code-enlightening experience please read the original blog post.






POSTED BY: Vitaliy Kaurov
6 Replies
Thanks Vitaliy for gathering all this info. I didn't expect Wolfram Research to pay much attention to the page since I figured you guys see more examples of how powerful Mathematica can be than most people. I thought maybe I would see a message from WR saying "We do not approve of 'the sierpinski triangle page to end most sierpinski triangles pages ™' because it fails to itallicize 'Mathematica' on multiple occassions."

It's been interesting seeing the overall response to the page because the original impetus for it was practical: helping me get a job. (I'm still working on that actually. And on a related note, Amazon will probably notice I don't have any money in my bank account, so if anyone knows a good place to host a static website let me know. I'll probably try GitHub's hosting.) After I started the page though, the vision for it kept growing and I decided to forget about practical concerns in its case.

I built the page up fairly casually over the course of about 4 months. Most of it was straightforward but there were a couple things that took a disproportionate amount of time, in some cases because there was a lot to experiment with, like with 3D cellular automata, and in others because I was obsessively iterating on the UI, like with the 3D matrix replacement program.

I am impressed how well the web page of that blog is designed. The links in the text affect and switch the images and M-code in the blog.

This was surprising to me when I first made my blog. Having words link to specific slides is a pretty obvious mechanic, yet I hadn't seen it anywhere. In fact you can make a variety of simple-yet-powerful composable switching things in HTML/JS not unlike Mathematica's basic UI controls that can be useful for all sorts of things. It's possible that people have had trouble implementing these kinds of ideas because they are clunky to do without using closures in Javascript. I think a nice Mathematica project would be something that converts Mathematica TabViews and special links into that linked form when exporting to HTML.

More than a few aspects of the page were due to serendipity. If Mathematica didn't have the cow/shuttle, I probably wouldn't have mentioned the Riemann sphere since it would have been too boring to describe. Then when I tried to color the cow black and white, I had the intuition to use a factor in the VertexTextureCoordinates (which I didn't really understand at the time) that happened to give that awesome appearance to the cow, which I assume is a consequence of the particular ordering of the vertices.

My favorite image on the page is #9 here, which I found by trying a particular angle where things happen to align in the image. It was almost an accident, but I don't think it would be fair to call any of these things accidents because Mathematica makes it really easy to experiment and iterate and follow your nose, etc. One of the things I've been surprised by is how uncommon Mathematica seems to be, for example, in data analysis. The various reasons for that are understandable, but still, don't those people realize what they're missing??? So it was my hope that the page's take-away message for technical people would be "you should probably be using Mathematica."

Something important here is that the page was only possible because of the Home Edition. It's interesting that people assume I'm a mathematician, but I'm just a random college dropout (I didn't even major in math). The regular license would have never been in my vicinity and even the Home Edition cost me a lot.

In any case, if anyone happens to have any questions I'll try to answer. One thing I can explain is that on a personal level, the page is basically me just screwing around. On its own it doesn't really have a purpose other than amusing me, which hopefully explains its irreverent meander. emoticon
I am impressed how well the web page of that blog is designed. The links in the text affect and switch the images and M-code in the blog. Kudos goes to Antonio for such a brilliant educational creative work. So many young people online gave positive comments to this that I wonder if this is an example of how to engage students of the future – with creativity, art and humor – even in math and programming.

One of my favorite graphics from the post:
 vertices =(**)5(**) {Cos[#], Sin[#]} & /@ (2 Pi Range[3]/3);
 
 check = Compile[{{x, _Real, 0}, {y, _Real, 0}}, 
    Module[{i, b, diff, z = {0., 0.}, vertices = vertices}, 
     Total@Table[i = 0; z = {x, y};
       While[z.z < 40 && i++ < 120, b = RandomChoice[vertices];
        diff = b - z;
        z = (z + b) Sin[Sqrt[diff.diff] + .01]];
       -i, {20(*0*)(*number of trials*)}]]];

img = ImageAdjust@
   Image@ParallelTable[
     check[x, y], {y, -6.5, 6.5, .01}, {x, -6.5, 6.5, .01}];

img // Colorize // ImageAdjust // ColorConvert[#, "Grayscale"] & // 
     ImageAdjust // ImageResize[#, Scaled[1/2]] & // 
   ImageRotate[#, -Pi/2] & // ColorNegate // 
 ImageApply[#^(1/1.3) &, #] &



 draw[block_, options___] :=
   Graphics3D[{EdgeForm[Darker[Gray]], Cuboid /@ Position[block, 1]},
    options, ViewVertical -> {-1, 0, 0}, Boxed -> False];
 
 f[block_, _] :=
   Switch[{block[[2, 2, 2]], Total[block, 3] - block[[2, 2, 2]]}, {_,
     4}(*|{1,2}*), 1, _, 0];
 
 evol = CellularAutomaton[{f, {}, {1, 1,
     1}}, {{{{1, 1}, {1, 1}(*,{1,1},{1,1}*)}}, 0}, 15];

ListAnimate[
draw[#, Lighting -> "Neutral", ImageSize -> 400 {1, 1}] & /@ evol]

POSTED BY: Darya Aleinikava
I'm 1/2 way through hoping he'll find a Sierpinski triangle in a financial data set to excuse me reading this in meeting prep time, but somehow I don't think I'm in charge.
You might be wondering why we don't just ask a biologist about these mysteries. The reason is because you're inside a car right now, I'm driving, we're lost, both of us are tourists, and I'm one of those people that would sooner burn hours of gasoline/diesel than ask for directions. You also suspect I might be some kind of criminal, so you're afraid of bringing up the issue. All around it's pretty awkward in here.
POSTED BY: Martin Hadley
Posted 12 years ago
What an incredible way to use Mathematica! The visuals available on the blog post are really fascinating.
POSTED BY: Tom Pauly
@Vitaliy, you have great taste of visual design, too.
POSTED BY: Shenghui Yang
We at Wolfram enjoyed Antonio's blog post so much we shared news about it on our official social media channels:
POSTED BY: Vitaliy Kaurov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract