Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
High-Resolution Mandelbrot in Obfuscated Python (preshing.com)
105 points by yaph on Nov 9, 2013 | hide | past | favorite | 20 comments


One thing that's nice about the Mandelbrot set is that you can calculate each pixel independently of all the other pixels. This means if you have 8 CPUs, you can split the image into 8 parts and render it that way.

I apparently decided to try this out about 4 years ago. Here's the result: https://gist.github.com/jrockway/291074

Still slow. Need to run this on some machines at work :)


Or convert it to Accelerate and kick it out on a GPU... :)


That was my first OpenCL project. I managed to make it render just slightly slower than on the CPU, which for a first time I consider a success.


A bit of topic, but the blog conclusion made me wondered if anyone would one day expose code in a museum.

Any people who've seen real top level code know there is a kind of beauty or at least aesthetic in very correct code, so why not put them on a frame and expose them. Same could be said of some really important mathematic or physic formulas, but they're sometimes short and their meaning really is obscure. Whereas code is at least partially written in human language, which would make such an exhibit still understandable by everyone.


I'm not sure about "code as art" but Bernar Venet uses a lot of mathematics in his works. http://nicolaanthony.wordpress.com/2012/11/18/a-perfect-synt...

He even framed an astrophysics paper once in the Centre Pompidou, http://scienceblogs.com/cognitivedaily/2007/06/08/euroupdate...


I've had some prints done of shaders I've written that were beautiful, and the next step for me is to put the code right along with the images. I see an odd kind of beauty in tying the two together, like seeing the palette next to a painting. Just need to figure out how I'm going to present it.


I've been looking for more geeky art to put up in my home office (like their version on CafePress with the code in the image - http://www.cafepress.com/preshing.571735472).

Does anyone know others like that?



It’s also available in porcelain :)

http://www.unfold.be/pages/5/items/85


Ulam Spiral.

I'll immodestly refer you to the Ulam Spiral I made the bottom of which is the source code for the program which makes the poster.

https://web.archive.org/web/20111215052134/http://imprompt.u...

The pdf is here: https://db.tt/pDoyOnXu


but... but that code doesn't print itself on the poster? ;)


Yes it does! That is the code that creates the entire poster - including the code at the bottom, the title, the author, the year, and the cc-attribution-nocommercial graphic.


I once generated this: http://panzi.deviantart.com/art/Prime-Numbers-102507767

Each red pixel represents a prime number.

The source download link is currently broken. I'll fix that in a minute (if I can find the source again).


A Sierpinski gasket? http://en.wikipedia.org/wiki/Sierpinski_triangle

It can also be generated by doing mod 2 on Pascal's triangle.


I would also suggest a nice play of the Game of Life with a lot of notable structures.


Do a little Googling for "3D printed Mandelbulb"


Maybe some cool 3D printed objects like a Klein bottle?


> If you’re willing to leave the script running for a few hours, you can increase the image resolution on line 8. (Just make sure the width is divisible by 4.)

You can make a lower resolution version too. I used:

    )  ;v,      x=1024, 800;C=range(v*x
which fakes the 4-width with a space before 800, and it worked fine: http://i.imgur.com/c9ossnw.png

I like this use of obfuscation a lot. Kudos to the author. (EDIT: Code format)



I humbly tip my hat to the author. And hope to create a hack, half as inspired in my lifetime.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: