Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'The Collatz Fractal' topicStudent Support Forum > General > Archives > "The Collatz Fractal"

Help | Reply To Topic
Author Comment/Response
Antti
10/20/10 12:26pm

I'd like to get fractals out of these functions:

f(z) = (1 + (-1)^z) (z/4) + (1 - (-1)^z) ((3 z + 1)/2)

g(z) = (z/4) (1 + Cos[Pi z]) + ((3 z + 1)/16) (1 - Cos[Pi z]) (3 - Sqrt[2] Cos[(2 z - 1) (Pi/4)])

h(z) = (1/4) (2 + 7 z - (2 + 5 z) Cos[Pi z])

What I got now looks like this (for one of the equations), and though it can be used to generate some pretty pictures it isn't quite what I want (need). What I would like to see is something like this: http://mathworld.wolfram.com/JuliaSet.html

collatz = Compile[{{z, _Complex}},
Module[{x = z, i = 0, s = 10.^5, vic = 10.^5 + 0.0 I, maxit = 100},
While[i < maxit && Abs[x] < s, i++;
x = 1/4 (2 + 7 x - (2 + 5 x) Cos[\[Pi] x]);
If[Abs[x] < Abs[vic], vic = Abs[x], vic];]; vic]]

sol = Table[
collatz[x + I y], {x, 1.5, 2.5, .003}, {y, -0.5, 0.5, .003}] // Chop;

ListDensityPlot[sol, Mesh -> False, ColorFunction -> (Hue)]

Any help would be highly appreciated.

URL: ,
Help | Reply To Topic