View Full Version : The Mandelbrot Set
YardGnome
11 Feb 2005, 09:02 PM
I was wondering if anyone here has any experience with plotting the mandelbrot set. I recently became quite interested if not obsessed in attempting to graph this equation to a bitmap.
For anyone that doesn't know, the mandelbrot set is a simple iterative function that uses the complex number system. When plotted, the result yield beautiful fractal images, like this for example... http://members.aol.com/waltertrump/jpg/mandelbrot.jpg
I would eventually like to attempt to write a winamp visualizer using these concepts but I'm getting way ahead of myself. I need to take it one step at a time...
ApeTheDog
12 Feb 2005, 01:50 AM
Well, I suppose telling you there are many programs out there that plots the mandelbrot set is somewhat superfluous, since I assume that screenshot you posted is from one of them. But just in case: there are lots of programs that can do this for you.
Good luck!
HackerX
12 Feb 2005, 11:21 AM
I remember doing a whole assignment on the mandelbrot set for high school maths once...
That being said.. can't remember it much, except that it it involves complex numbers and an iterative formula.
The maths is all here though http://mathworld.wolfram.com/MandelbrotSet.html
Network Alchemy
12 Feb 2005, 05:49 PM
it is very simple particularly the pointwise method of generating it
as you saw the recurrence equation is z[n+1] = z[n]^2 + C
the process is as follows
for each point in the complex plane (x + iy)
{
set C and the initial value of z as that point
perform the recurrence of the equation some number of times
if after or during those calculations the value exceeds 2
do not plot this point
else
plot this point
}
how many times the equation is recurred in the second step depends on the desired accuracy
often the number of times the equation is recurred before the value exceeds 2 is used to color the points surrounding the set
i have not plotted this set in some time so i will write a quick program to test my supposed knowledge
Network Alchemy
12 Feb 2005, 05:57 PM
on third thought i am too lazy to do this but certainly let me know if my pseudocode does not lead to success
YardGnome
12 Feb 2005, 08:13 PM
Thank you, the psuedo code, and the provided link should certainly be more than enough to get me going in the right direction.
glassmoon
13 Feb 2005, 03:33 PM
...
I would eventually like to attempt to write a winamp visualizer using these concepts but I'm getting way ahead of myself. I need to take it one step at a time...I don't see how it is possible. The computation required for it are way to complex and can't be drawn in real time... First real use for the 64bit processors...
Anyway, do the Mandelbrot set, or other fractals represent some chaotic systems? I saw fractals that look like clouds, trees, etc...
Network Alchemy
14 Feb 2005, 05:39 AM
yes their basis is chaos
fractal mathematics are used commonly in the computer graphics world and you will encounter them in things such as terrain and tree generators as well as graphic effects such as fire and relatedly skin systems for automatically adding wrinkles spots etc to models
KPT filters for photoshop is amost entirely based on fractals. Bryce also. cumpitational tree generation is fractalic. 3d plant generation is fractalic.
there are many more sets and systems. julia set, l-system, theres (x)d fractals, things that look like the northern light, etc.
http://spanky.triumf.ca/www/fractint/fractint.html
of you want a go with fractals
Dunearhp
14 Feb 2005, 08:20 AM
it is very simple particularly the pointwise method of generating it
as you saw the recurrence equation is z[n+1] = z[n]^2 + C
the process is as follows
for each point in the complex plane (x + iy)
{
set C and the initial value of z as that point
perform the recurrence of the equation some number of times
if after or during those calculations the value exceeds 2
do not plot this point
else
plot this point
}
how many times the equation is recurred in the second step depends on the desired accuracy
often the number of times the equation is recurred before the value exceeds 2 is used to color the points surrounding the set
i have not plotted this set in some time so i will write a quick program to test my supposed knowledge
That will give you a black and white plot.
If you want colour you need to count the iterations before it exceeds 2 and scale the colours accordingly. You also need a timeout since some points never diverge.
Years ago i wrote a program in qbasic (in DRDOS, on a 386. Woohoo I even had a math coprocessor.) to plot the Mandelbrot set. Long since lost it I am afraid. To zoom in properly you need arbitrary precision floating point. That gets REAL SLOW.
Network Alchemy
14 Feb 2005, 11:32 AM
~
If you want colour you need to count the iterations before it exceeds 2 and scale the colours accordingly.
often the number of times the equation is recurred before the value exceeds 2 is used to color the points surrounding the set~
You also need a timeout since some points never diverge.
perform the recurrence of the equation some number of times
how many times the equation is recurred in the second step depends on the desired accuracy
Trolsk
14 Feb 2005, 04:00 PM
I wrote a Julia morpher in Pascal once, on a 386 without FPU. It was simple code, and damn slow rendering.
I don't see how it is possible. The computation required for it are way to complex and can't be drawn in real time... First real use for the 64bit processors...
It's always possible to cheat (precalculate), like in Triton's Crystal Dream 2 (http://www.pouet.net/prod.php?which=462). :)
glassmoon
14 Feb 2005, 04:50 PM
It's always possible to cheat (precalculate), like in Triton's Crystal Dream 2 (http://www.pouet.net/prod.php?which=462). :)I couldn't find anything there.
I wonder if it's possible to render 3D fractals, at least simple ones. By the way, what's the O(n) of fractals?
Dunearhp
14 Feb 2005, 05:00 PM
how many times the equation is recurred in the second step depends on the desired accuracy
How many times you will allow the equation to recur before deciding it probably won't diverge depends on the desired accuracy. The number of times it recurs before diverging depends on the recurrence relation itself. :devil:
;P
Sorry that I missed what you had said before.
Network Alchemy
14 Feb 2005, 05:53 PM
I wonder if it's possible to render 3D fractals, at least simple ones.yes it is
as far as topological dimension there are 1 dimensional fractals 9 dimensional fractals etc
as far as Hausdorff dimension (also called fractal dimension) there are 2.53451 dimensional fractals .026 dimensional fractals and i might be nonlazy enough to explain this dimension later
YardGnome
14 Feb 2005, 05:59 PM
I don't see how it is possible. The computation required for it are way to complex and can't be drawn in real time... First real use for the 64bit processors...
I'm not 100% sure but... I think (correct me if I'm wrong) that some of the visualization routine's in Ryan Geiss' winamp plugin milkdrop use fractal geometry as a basis. Maybe a few iterations are recorded internally and rather than calculating more he just uses the results as a basis of a particular animation sequence?
If you have never seen milkdrop in action it comes highly recommended. It is utterly mesemerizing. I have stared at thing for hours and it always seems to do something new...
Check it out if you haven't seen it...
http://www.nullsoft.com/free/milkdrop/
glassmoon
14 Feb 2005, 06:59 PM
I'm not 100% sure but... I think (correct me if I'm wrong) that some of the visualization routine's in Ryan Geiss' winamp plugin milkdrop use fractal geometry as a basis...
http://www.nullsoft.com/free/milkdrop/
Oh, wow. It's the first visualization plug-in I actually liked.
It does look like familliar fractals (produced playing Billy Idol...):
http://www.geocities.com/a_change_0f_seasons/plgin.bmp
http://www.geocities.com/a_change_0f_seasons/plugin.bmp
Great plug-in, YardGnome!
About fractals geometry, I don't get it, how geometrical shapes with mathematical order can be related to chaotic phenomena?
edit: that's a cool fractal: http://astronomy.swin.edu.au/~pbourke/fractals/quatjulia/q3big.gif
Network Alchemy
14 Feb 2005, 07:28 PM
if you look at code to create many fractals you will find within them
r = random();we do not use math to create fractals ~ rather we use it to try to understand them ~ a common example is the length of a coastline ( which is fractal like so many things in nature ) that we are humorously unable to measure cosistently (country A will measure 5 kilometers but country B will measure 6) but fractal geometry has brought this to light
chaos is not quite as chaotic as its name implies and the way i see it is that chaos is always a result of two or more entities and so the real area of interest is those entities and their physics and not the fictional chaos but these are just my thoughts
Network Alchemy
16 Feb 2005, 12:01 AM
i wrote a small program in java although i am unable to have it properly formated by the code tags
the meat of the code is in the paint method
package mandelbrot;
import java.awt.*;
import java.applet.*;
/**
* @author Satan
* Feb 14, 2005
**/
public class Mandelbrot extends Applet
{
final int recur = 100;
final double xMin = - 2.1, xMax = .6,
yMin = -1.08, yMax = 1.08;
double width, height;
Complex z, C;
public void paint( Graphics g )
{
width = (double)this.getSize().width;
height = (double)this.getSize().height;
for( int x = 0; x < width; x++ )
for( int y = 0; y < height; y++ )
{
C = new Complex( x, y ).map();
z = C;
for( int i = 0; (i < recur) && (z.a <= 2 ); i++ )
z = z.mul( z ).add( C );
if( z.a <= 2 )
g.drawLine( x, y, x, y );
}
}
public class Complex
{
double a, b;
Complex( double real, double imaginary )
{a = real; b = imaginary;}
private Complex mul( Complex arg )
{return new Complex( this.a*arg.a - this.b*arg.b,
this.a*arg.b + this.b*arg.a );}
private Complex add( Complex arg )
{return new Complex( this.a + arg.a, this.b + arg.b );}
//map screen to logical coordinates
public Complex map()
{return new Complex( xMin + a*(xMax-xMin)/width,
yMax - b*(yMax-yMin)/height );}
}
}this creates a simple black and white plot but color is no problem at all as can be seen in the attachment created with little modification but sadly the attachment filesize limit is tiny
Network Alchemy
16 Feb 2005, 12:19 AM
it is important to note that the mandelbrot set is a set and any points which diverge during the infinite recursion of the equation are not in the set and another way to say it is that a point is either in the set or not in the set ie mathematically it is black and white and color is cosmetic
YardGnome
22 Dec 2008, 04:35 PM
Answering my younger self from 4 years ago...
You did it eventually (a couple years ago) but you're so ADD that you never finished designing a very good interface (if what's there qualifies as an interface)...
http://www.stephenlinde.com/Mandelbrot/
Drag a box around a part to zoom in. You dumb shit, you never implemented a zoom out method or avi zoom movie generator like you envisioned... It has been done before what's the point?
I would eventually like to attempt to write a winamp visualizer using these concepts but I'm getting way ahead of myself. I need to take it one step at a time...
You fuckin retard, you could never generate the set in real time and modify it to music... Oh and good luck setting aside the time to do that visualizer, you'll never get around to doing that! Look, you barely pursued your interest in the set enough to design a barely usable java applet...
Ooo harsh, I doubt he'll reply unless he invents time travel.. Oh wait that's right! He didn't...
Powered by vBulletin™ Version 4.0.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.