A world in dk(decay/denmark) » Fractal http://rotand.dk Just another pointless weblog Sat, 30 Nov 2013 21:03:48 +0000 en-US hourly 1 https://wordpress.org/?v=4.3.18 Strange Attractor Wars http://rotand.dk/2008/04/08/strange-attractor-wars/ http://rotand.dk/2008/04/08/strange-attractor-wars/#comments Mon, 07 Apr 2008 22:10:04 +0000 http://rotand.dk/blog/2008/04/08/strange-attractor-wars/ Strange Attractors are quite pretty.

I made have generated quite some random attractors.

Now I need to find the most beautiful ones, and I need your help!

I have created a voting system, where 3 attractors line up and you select the best one. The votes are then accumulated and and overall top 10 is generated.

Strange Attractor wars

It is heavily inspired by kittenwars.com.

I have been hacking away on this far to long. But expect an article with more details on Strange attractors and probably more features in the “war” application. (like top 100, biggest looser, most victorious etc).

Now just go and make some votes :)

]]>
http://rotand.dk/2008/04/08/strange-attractor-wars/feed/ 5
Newton fractals http://rotand.dk/2007/09/22/newton-fractals/ http://rotand.dk/2007/09/22/newton-fractals/#comments Sat, 22 Sep 2007 15:47:35 +0000 http://rotand.dk/blog/2007/09/22/newton-fractals/ I the moment I’m taking a course in Numerical Analysis, and here we were of course introduced to the Newton-Raphson method for finding roots. That is the method where, geometrical speaking, we take at tangent line to a function and use that to approximate the root, and keep on doing that until we reach satisfying precision.

Depending on where you start the iteration you get a a different root, and requiring a different amount of iterations. That’s self-evident. The “funny” part is that when searching for complex roots there are areas in the complex plane, where a very small difference in starting point gives different roots, and with remarkable difference in the number of iterations.

Newton for x^4+2

This is a plot where each root in the polynomial x^4+2 have been assigned a different color. And each point is colored according to which root a iteration starting here finds.

Now thats the mathematical part of it. Now to the beautiful part or at least more fascinating part. The pattern reapeats it self, as a fractal, when you zoom in.

So i modified my code to zoom in, and i used a diffenrent coloring scheme where i only colored according to the number of iterations taken. This made it possible to generate a video zooming in og showing the rapeating patterns in “nice” colors.

Here a some videos :

4 roots (14.6 mb)
7 roots (50 mb)

Yes I know that its very large files, and maybe i will upload them to google video at a later time for easy viewing and less quality.

]]>
http://rotand.dk/2007/09/22/newton-fractals/feed/ 0
Java life simulator http://rotand.dk/2007/06/01/java-life-simulator/ http://rotand.dk/2007/06/01/java-life-simulator/#comments Fri, 01 Jun 2007 14:31:54 +0000 http://rotand.dk/blog/2007/06/01/java-life-simulator/ Having played a bit with cellular automata’s – and looking at various other rulesets. I started to wonder what the result would be if every cell had i different ruleset, or just different types of cells interacting.

And what if there were mutations and sexes involved ?

Well getting ideas like that are dangerous, they usually result in some kind of coding project. And well this time I felt the urge to implement some features. Instead of continuing to try to write in c++ with CImg or SDL, which is kinda of new to me. I went back to java. Mainly because I’m more experienced with java and I have some code that I can reuse from earlier projects ( a flamefractal render and a small framework for rendering strange attractors ).

So I started hacking away making nice features and building a framework for experiments. Where there are generic cells and loose coupling using interfaces.

A cell just needs to implement :

  • a constructor taking its coordinates, and the map it belongs to as arguments
  • a isAlive()
  • boolean iterate () which gets it neighbors from the map and decides wheter it should be dead or alive in the next round
  • nextState() instead of using buffers I decided to have a method in a cell that changes it state, and as a ugly temporary hack at the same time returns value to determine its color

Of course in order to apply more interesting rules I need them to have a type, and they should be able to decide their fate based upon their neighbors types. And I still need to figure out a way to implement some kind of generic ruleset, if/when I need a way to mutate.

All the cells are placed in a double array (cells[][] ) and there’s a CellMap – class keeping track of them. I tried optimizing by only looking a cells that are alive, and their neighbors – instead of looking at every cell in each iteration. I used a MVC pattern so the map runs in its own thread and after each iteration it calls the gui to be painted. Its quite fast at iterating, but the painting process takes forever. Alas, the next step is to use a buffered image to speed op the rendering process, or …

After all these fancy designpatterns, threading all it does at the moment is a simple “life-like” cellular automata, but Its made for extending. And It has nice coloring., in earlier experiments i have made a generic gradient class, which came in very handy.

By the way please take a look at my online collection of random strange attractors

]]>
http://rotand.dk/2007/06/01/java-life-simulator/feed/ 0
Finite Automatons and images http://rotand.dk/2007/05/28/finite-autamatons-and-images/ http://rotand.dk/2007/05/28/finite-autamatons-and-images/#comments Sun, 27 May 2007 21:45:56 +0000 http://rotand.dk/blog/2007/05/28/finite-autamatons-and-images/ At a lecture about regular expressions and automatons, we were introduced to the posibility of using automatons to compress images. During the course we have worked with a java package for automatons, so i made a quick hack to render regexps as images.

The concept is that every acepting state represents black area, and and using a recursive definition of the areas.

area

Here is the area for the string “031”

Using this recursive definition it is posible to adress alle aereas, well in reality I choose a “resolution” and using strings upto a certeain length. I generate all the strings and check whether they are accepted, and should be colored.

A couple of examples.

  • regexppicure
  • regexppicure2
  • regexppicure3

The hack I used to make the images above (regexp_picture_render), you need the dRegAut packackage thou it might work with this (http://www.brics.dk/automaton/)

Here is a few regexps to try out, some are more interesting than others…

  • (1+0+2+3)*(30+03+12+21)
  • (0+1+2+3)*(22+11+00+33)(1+2)
  • (0+1+2+3)*(33+00)(1+2+3+0)*(0+3)
  • (1+2+3)*03(1+2)
  • ((0+1+2+3)*(12+21))+((03+30)(0+1+2+3)*)
  • (((0+1+2+3)*(12+21))+((03+30)(0+1+2+3)*))(1+2+3)*(1+2)
  • (((0+1+2+3)*(12+21))+((03+30)(0+1+2+3)*))(1+2)(1+2+3+0)*(0+3)
  • (((0+1+2+3)*(12+21))+((03+30)(0+1+2+3)*))(1+2+3)*03(1+2)
  • (((0+1+2+3)*(2+1))+((2+1)(0+1+2+3)*))(1+2+3+0)*0(1+2)
  • (((0+1+2+3)*(2+1))+((2+1)(0+1+2+3)*))(1+2+3+0)*3(0+3)
  • (1+2+3+0)*(1+2)(0+3)(1+2)
  • (1+2+3+0)*(1+2)(0+3)(1+2)
]]>
http://rotand.dk/2007/05/28/finite-autamatons-and-images/feed/ 0