Just for Fun - Mandelbrot Set

Started by SolarFreak, October 22, 2014, 12:18:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SolarFreak

Just for fun! Enjoy.  I plan to stretch a surface across all those lines eventually.  The default values in the code give good results. The .01 step size is a bit slow (on my machine anyway).  Definitely could use some tweaking (and some color!).

'Mandelbrot Set

'Settings

'Iterations Per Point
iterations=500

'Point Step X
step_x=.01

'Point Step Z
step_z=.01

'Y Value is Computed / Height

'Start X
start_x=-2.5
'Start Z
start_z=-1
'Stop X
stop_x=1
'Stop Z
stop_z=1

FOR current_z = start_z to stop_z step step_z
>Line
{
FOR current_x = start_x to stop_x step step_x
current_iteration=0
x=0
z=0
DO WHILE ((((x*x)+(z*z)) < (2*2)) and (current_iteration < iterations))
xtemp=x*x-z*z+current_x
z=2*x*z+current_z
x=xtemp
current_iteration=current_iteration+1
LOOP
<Pointxyz [current_x,current_iteration/1000,current_z]
NEXT
}
NEXT

samdavo

#1
well solar, I'd never heard of it until your post, but herewith a coloured version (compliments of Wiki).   

And is there any use for this!? lol - and is this "use" real or imaginary?

http://en.wikipedia.org/wiki/Mandelbrot_set#mediaviewer/File:Animation_of_the_growth_of_the_Mandelbrot_set_as_you_iterate_towards_infinity.gif

Then there is this one called "self similarity" :)

http://en.wikipedia.org/wiki/Mandelbrot_set#mediaviewer/File:Mandelbrot_zoom.gif

prl

Forget the "Brot",  Mandelaugen (Almond Eyes).



SolarFreak

Quote from: samdavo on October 23, 2014, 01:58:29 PM...(compliments of Wiki)....

If you look down through that article under the computer drawings section, you'll notice some [self] similarity between the pseudo code there, and my code...  ;)

As far as use... Eh.  Sections of it properly rendered and viewed resemble mountain ranges.  CG Landscape?!  It's just plain fun to play with too.

Imaginary numbers are great for modeling AC circuits with inductive and capacitive components.  Although if you ask me, is just plain old black magic masquerading as math.  Although, results don't lie.

samdavo

solar
I've responded on another thread (general discussion) with rotating vectors that have components in real and imaginary axes (2 cents)
cheers
sam

prl

Quote from: samdavo on October 24, 2014, 03:24:24 AM
that have components in real and imaginary axes (2 cents)

You're forcing me to open a text book (again)!  You into Hankel transforms too?  There are some things you just can't do when you're over 30.

samdavo

#6
prl
Never heard of Hankel (or if I have I've forgotten lol).
But I was "middle-aged" when I first heard (or really twigged to) the terms time and frequency domains, together with a stack of maths involving e^jwt, eg

e^jwt=cos(wt)+j*sin(wt)
where cos(wt) = coordinate on real axis, and
sin(wt) = coordinate on imaginary axis.
and j = sqrt (-1).

and this defines the location of the end of one of those spinning arrows, (on the other thread) spinning at w rads/sec, time t,  etc. (But maybe I had my axes mixed up).

As solar said, weird but useful, i.e. the fact you use sqrt (-1) to explain it this way.
Brilliant (black magic) stuff :)