[Call to coders, a new type of fractal.] - A New Kind of Science: The NKS Forum

A New Kind of Science: The NKS Forum

Pages:1



Call to coders, a new type of fractal.

(Click here to view the original thread with full colors/images)



Posted by: alan2here

I'm going to go first into the maths, im using some programming constructs as well.

n = v1
start of loop
n = sin((n * v2) + v3)
end of loop

Where v1, v2 and v3 are values that stay the same throughout the render and n varies. The * and + can be interchanged also. n plotted in a graph (iterations count on the X axis and values of n on the Y) when v1, v2 and v3 are correct (although v1 is often the least important) can produce a chaotic waveform and this chaos can be used to create fractals. It can also iterate to a value or create a predictable waveform, the chaotic values are quite frequent however they are in bands and it is not always obvious where to find them. It generally helps if v2 is greater than 1 and non-integer although it does not benefit from being a large number.

The method can be simplified to it's main idea which is
n = sin(function(n))

I am going to use this terminology throughout my explanation so please be aware that when an example is used such as the above example then there will probably be an equivalent to the v2 and v3 in the first example of this post integrated into the function, also I may put something like function(x, y) this could mean (((x * v1) + v2) + ((y * v3) + v4)). My times and add method is good to use in your function as I know it works really well.

Instead of using the equation at the top of this post this could be used
x2 = sin(function(x, y))
y2 = sin(function(x)) * y
x = x2
y = y2

That way you get an X and a Y to plot and can use as a strange attractor where the position of each successive point is dependent on the last position.

Alternatively

start of outer loop
increment v2 or v4 to get the pixel you are using to cover the whole screen
n = v1
start of inner loop
n = Sin(function(v2, v3)) + Sin(function(v4, v5))
end of inner loop
plot (v2, v4), n
end of outer loop

In this example v2 and v4 are the X and Y positions on the screen and n is the value representing the color of the pixel. v1 is the starting point for each pixel.

Another idea is to do the earlier strange attractor example but to vary the start position or other values across x and y so you end up with millions of strange attractors, and then create a scoring system for each attractor, an example would be where attractors score more for having points close to each other and less for more scattered, you will have to use the Pythagoras method "distance = sqrt(((x1 - x2)^2)+((y1 - y2)^2))" where x1, x2, y1 and y2 are the x and y cords of the two points you are comparing. The more points an attractor scores the further through a gradient its corresponding pixel.

I'm sure some of you can think of more and equally sure I confused all of you, this was not deliberate.



Posted by: Jason Cawley

If you have Mathematica 6, you can program this system and display the results, interactively, in two lines, as follows -


SinFract[start_, anglefactor_, angleadd_, steps_] := 
 NestList[Sin[# * anglefactor + angleadd] &, start, steps]

Manipulate[
 ListLinePlot[SinFract[start, anglefactor, angleadd, steps]
  PlotMarkers -> Automatic, AxesOrigin -> {0, 0}, Frame -> True, 
  PlotRange -> All],
 {{start, 0.9}, -1, 1}, {{anglefactor, 1.3}, .5, 
  6.3}, {{angleadd, .1}, -[Pi]/2, [Pi]/2}, {{steps, 10}, 1, 100, 1}]


The first line is your function, with four parameters. NestList says do this nestedly steps times and leave a trail of the results.

The second line creates an interactive plot with controls for your variables on "sliders".

Even if you don't have Mathematica 6 to make this sort of illustration in a few minutes, you can still use the result, because I used our new "Publish for Player" feature, here -

http://www.wolfram.com/solutions/in...oyment/publish/

You can get Mathematica Player, free, from this link -

http://www.wolfram.com/products/player/download.cgi

I will attach this specific interactive notebook below. All you need is Player to use it.

It is a reasonably interesting little system, incidentally. It reminds me closely of the kneading route to chaos system described on 307 of the NKS book. The whole section starting at page 304 is relevant.




Posted by: Jason Cawley

Here is the actual .nbp Player file...



Posted by: alan2here

Thanks :¬) I'm downloading the files now.

I can make lots of the variations mentioned in my first thread already in programming languages. I'm also looking for people who want to expand the ideas and turn them into practical fractal software like Ultra-Fractal is, or otherwise use the concepts in there own mathematical works.

Thank you for your file Jason Cawley unfortunately it contains some errors.

ListLinePlot::lpn: "SinFract[-0.495,4.02,0.992743,80] is not a list \
of numbers or pairs of numbers."

There is also no visual output. Just the words
"ListLinePlot[SinFract[-0.415,4.02,0.609469,80],PlotMarkers\[Rule]\
Automatic,AxesOrigin\[Rule]{0,0},Frame\[Rule]True,PlotRange\[Rule]All]"

In a red box.



Posted by: Jason Cawley

Sorry, my bad. The live code version evaluates the first line to define the SinFract function, which the second then uses. For the player version of the file, I needed to add a SaveDefinitions->True to my Manipulate command, to remember that function (without a full Mathematica).

No functional changes. Try this attachment in place of the previous...



Posted by: alan2here

Thanks, a little slow and clunky but it demonstrates the effect.





Forum Sponsored by Wolfram Research

© 2004-2008 Wolfram Research, Inc. | Powered by vBulletin 2.3.0 © 2000-2002 Jelsoft Enterprises, Ltd. | Disclaimer
vB Easy Archive Final - Created by Xenon and modified/released by SkuZZy from the Job Openings