Register to reply 
How can I make my own fractals?by piercebeatz
Tags: fractals 
Share this thread: 
#1
Jan113, 07:20 PM

P: 232

Hello everyone. You probably all know about the Mandelbrot set. I am not here to ask questions about the set itself, but how I can graph fractals similar to it. Is there a program where I can input my own equations? Or would I have to be a java expert to do so? The fractals that I want to make are similar to the Mandelbrot set: I want the computer to color a point black if the point converges after a number of iterations and I want to color the points that do not converge according to escape time.
By the way, I don't know the first thing about programming/computer science. 


#2
Jan213, 01:55 AM

Admin
P: 23,363



#3
Jan213, 06:49 AM

Sci Advisor
PF Gold
P: 1,381

Great link, that one. Thanks Borek.



#4
Jan213, 04:09 PM

P: 232

How can I make my own fractals?
Also, I am worried that even if I find a decent fractal generator, it may not be able to do what I want. I am interested in generating a fractal where, in the style of the mandelbrot set, a point z is colored black if it converges for ##z^z^z...## and it is colored based on escape time if it diverges. 


#6
Jan313, 01:12 PM

P: 1,029

I don't understand anything about fractals, so be careful with this.
This is a few lines written in Mathematica which I think tries to do what you are asking for. It creates a square matrix of z^z^z... as long as the z^z^z are within a distance of 2 from the origin. Some wiki page said that was the criteria for escaping to infinity. It only builds a tower of z^z^z... 20 levels high before it bails out and assumes it will never escape. Then it displays a plot of that table. It does this over 2<=a<=2, 2<=b<=2 with steps of .01 for a and b. Norm[] is a function that calculates the distance from the origin to a point. In[1]:= ArrayPlot[ Table[n = 0; z = a + I*b; r = z;While[Norm[r] < 2. && n < 20, r = r^z; n++]; n,{a, 2., 2., .01}, {b, 2., 2., .01}] ] Out[1]= <plot snipped and attached> I assumed your equation wouldn't be fractal because it seemed too simple to me. The first half dozen times I tried this I got a round black disk and thought I was right. Then I changed something to try to make this more readable and got a black sheet. That seemed wrong and I changed all kinds of things before I got the attached image. This may still be wrong, but you need someone who knows a lot more than I do to tell if this is right or not. If I have errors in this and someone can explain how I am supposed to fix it then I would try to do that. Mathematica is not free. For some it isn't even cheap. But it does run on Mac. If you ask very very nicely you can get a free trial version that works for a couple of weeks or a month. If you arranged to have nothing else to do and didn't sleep and you saw how to ask questions about Mathematica so you quickly got good answers then you might be able to learn a lot and get a lot of fractal images from various equations done before your trial expired. I would suggest getting an introductory book on Mathematica and learning as much as you can before you ask for your trial so that you don't spend your limited trial time frustrated with little problems instead of getting good pictures done. I don't think the trial lets you save files, so you may be limited to capturing the images on the screen. If you want a few more images of this changing the location, the resolution, the maximum number of steps or zooming in on part of this then I would offer to do a few more experiments to help you get ready to start doing this yourself. If after your trial you decide Mathematica is the tool for you then there are somewhat reasonably priced versions for home use. Add the price of a couple of books that will help you learn how to use it and you can try to learn to do fractals and lots of other things. One other caution. As you see, Mathematica can be very flexible and you can change the function you use as well as anything else, but such flexibility sometimes comes at the price of speed. The simple example I showed will be substantially slower than a carefully optimized program written by an expert. It is sometimes possible to speed up Mathematica calculations, but that often requires more knowledge than a beginner can easily find. 


#7
Jan313, 07:54 PM

P: 232




#8
Jan313, 09:10 PM

P: 1,029

The fumbling around was trying to make the example as simple and understandable as I possibly could, so you or others could hopefully understand it and point out any mistakes. If you are fairly sure what the equation should be then you might be able to calculate the result for some particular value of z. If you let me know what the values for z and powers of z are then I could see if I'm getting the same result you are. That might help expose mistakes. 


#9
Jan413, 12:24 AM

P: 188

I have a program that generates the Mandelbrot Set on my website. It's written in JavaScript and uses the new HTML 5 canvas tag. The source is cobbled together from a couple of other programs that I have referenced, and I have grand plans for it that include a much better color palette and much deeper zoom. You can view the source.
I'm posting it because the program is actually very simple, and the platform (JavaScript/HTML5) is available to most anyone with a computer, without downloading any extra software. All of the meaningful code is inside the drawMandelbrot() function and all it does is set some initial parameters and then with a system of three loops, iterates over every x,y coordinate on the canvas (that's two loops, for all x, for all y) and then runs an inner loop (for i until max_iterations) to determine whether the complex number that defines that x,y coordinate (i.e 1 + 2i is x,y coord 1,2) is part of the set or not. The maths is very easy, and the program is too. As for generating other fractals, I have a program called ChaosPro but to be honest, I haven't used it much, or recently. I believe you can load new formulas as files and use it to generate your own, but you would have to investigate that yourself. 


#10
Jan413, 02:11 PM

P: 232

Edit: My math teacher suggested that I find a way to do this by iterations. I'll spare you the ugly work, but here is the value of ##(a+bi^{(c+di)}##: $$(a+bi^{(c+di)}=(a^2+b^2)^{c/2}e^{d*\text{arctan}(b/a)}\text{cis}(d*\text{ln}(a^2+b^2)/2)\text{cis}(c*\text{arctan}(b/a))$$ Thus, the iteration is: $$a+bi \to (a+bi^{(c+di)}=(a^2+b^2)^{c/2}e^{d*\text{arctan}(b/a)}\text{cis}(d*\text{ln}(a^2+b^2)/2)\text{cis}(c*\text{arctan}(b/a))$$ c+di is the complex number whose convergence we are testing. a+bi is the number that is obtained from an iteration. Thus, for the initial iteration, a+bi=c+di. 


#11
Jan413, 02:33 PM

P: 1,029

For the simple example I showed: about 35 seconds.
Cut the step size in half, so 4x the points, and raise exponents to 40: about 5 minutes 40 seconds. I'm not sure whether doing the repeated multiplies would be slower than doing the arctan and cis and log or not. 


#12
Jan413, 02:38 PM

P: 232

Can I see the higher quality version?



#13
Jan413, 03:23 PM

P: 1,029

Doesn't look much different to me



#14
Jan413, 03:57 PM

P: 232

This is great. It appears, at the bottom left and right of the set, that points outside the radius of 2 converge. Could you make try making the set bounded by a circle of radius 3?



#15
Jan413, 04:51 PM

P: 1,029

I still have no idea whether this is correct or not.
I'm guessing the wiki "diverges for x>2" may only apply for repeated squaring and not for your exponentiating In[1]:= ArrayPlot[ Table[n=0;z=a+I*b;r=z;While[Norm[r]<3.&&n<20,r=r^z;n++];n,{a,3.,3.,.01},{b,3.,3.,.01}] ] Out[1]= plotSnipped In[2]:= Export["zfrac3.jpg",%,ImageResolution>200] Out[2]= zfrac3.jpg 


#16
Jan413, 05:13 PM

P: 232

Do you know what it means if an area is grayer than another area? Is that based on escape time?



#17
Jan413, 05:39 PM

P: 1,029

The darker it is the more z's in z^z^z^z... were needed before the value of that became greater than 2 (or 3).
So out side the circle of radius 2 (or 3) is white because it took zero exponents to be greater than 2 (or 3), in other words z was already enough. The slightly darker shade just inside the circle took one exponent, z^z to escape. The next darker shade in the "bands" on the "wings" took two exponents, z^z^z to escape. The black center did not escape in 20 (or 40) exponents. 


#18
Jan613, 06:26 PM

P: 194

around the one and a half second mark in Mathcad 15 on a Dell Dimension 521 (Athlon 54 dualcore 2.5 GHz with 4GiB RAM running Windows 7 32bit)  the lighter the image, the quicker the escape. Around one second for an n=64 standard Mandelbrot over the same x and y ranges.



Register to reply 
Related Discussions  
Fractals Please!  Differential Geometry  1  
Using geometeric series to get different shapes  General Math  2  
Question regarding Julia sets  General Math  1  
Like fractals?  General Physics  4  
Fractals of rational dimension and fractals of integral powers  General Math  3 