Go Back   Science Forums
View Single Post
Old 03-07-2006   #25 (permalink)
Pyrotex's Avatar
Pyrotex
Slaying Bad Memes


Location:
Houston, Texas
Latest blog entry:
 
Pyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond repute
Send a message via MSN to Pyrotex
 



Not Ranked  0 score     
Re: Fractal Geometry of Nature

Quote:
Originally Posted by TheBigDog
I am just a poor boy and my story's seldom told
I have squandered my existance
For a pocket full of fractals such as Mandelbrot
The Boxer. I love to whistle along with that song.
Quote:
OK Pyro, I've got the formula in front of me, but I am lost about how I begin the calculations. C = a, bi where a and b are any real numbers. I can create the looping formula looking for a value >2. But what gives me the starting value for each point on the space? And what is i?
"i" is the square root of minus one. Having said that, ignore it. You will be dealing with ordinary "x,y" coordinates on your display plane.
Assume you have two variables a and b. Where C(0) = a, bi

a and b are the "x,y" points on a small section of the plane around the origin.
Absolute values for a and b need not ever exceed 2, though I use 2.5

So, you have to have two nested loops that look something like:
For a= Alow to Ahigh by Ainc; increment by Ainc
For b= Blow to Bhigh by Binc; increment by Binc
; perform all the iterations of C [below] until either
; number of iterations > IterMax [you're IN the MS, color=Black] or
; asq + bsq > 4. [Avoid taking the square root]
Next b;
Next a;

Now I can answer your question. Where you start is with selecting the low and high values of a -- and the low and high values of b. The increments you will use are determined by the number of pixel columns and pixel rows you will have in your final graphic. Say you choose 640 columns by 520 rows. (I did) And say you start with Alow=-2.5, Ahigh=+2.5, Blow=-2.5, Bhigh=+2.5.
Then Ainc will be 5/640, Binc will be 5/520. This will display the entire MS.

Now let's look at the iteration code INSIDE the double loop above.
Then C(1) = C(0)^2 + C(0)
C(1) = a', b'i, where we have to calculate the new a' and b'
asq = a*a;
bsq = b*b;
a' = asq - bsq + a;
b' = 2*a*b + b;
CntIter = CntIter+1;
newCsquare = asq+bsq;

Your iterations of C(n) stop under either of two conditions:
newCsquare > 4, in which case you plot the point with color CntIter,
or CntIter > IterMax, in which case you plot the point with color Black.
Then you fall into the bottom of the double nested loop, calculate the coordinates of the next pixel in the next column (or the first pixel in the next row) and repeat.

The tricky part in all this is the geometry of your display. Your question reflects that this is indeed the part you tripped on. No shame in that. I had to draw a dozen hand-drawn, pencil-on-paper diagrams showing the relations of my final pixel space, the rectangular subset of the starting MS values
(-2.5<a<2.5;-2.5<b<2.5), the coordinates of the center of my rectangle, and the a-increment and b-increment, before I wrote successful code.

This should get you started. If you get stuck, I'm here.


----------------
Hypography Forums Moderator
-- - - - - -
What concerns me is not the way things are, but rather the way people think things are.
Epictetus, Greek Philosopher
The map is NOT the territory.
Korzybski, Polish-American Philosopher

Last edited by Pyrotex; 03-07-2006 at 12:33 PM..
Reply With Quote
 
» Advertisement
» Current Poll
Who's the sexiest man alive? Johnny Depp or Robert Pattinson?
Johnny Depp - 30.00%
3 Votes
Robert Pattinson - 0%
0 Votes
Someone else (please specify) - 40.00%
4 Votes
I'm too macho to think a guy is sexy - 30.00%
3 Votes
Total Votes: 10
You may not vote on this poll.


All times are GMT -8. The time now is 10:48 PM.

Hypography?

Hypography [n.]: A combination of "hyperlink" and "bibliography" - ie, a list of links to electronic documents. Comparable to discography and bibliography, but not cartography.

We have been online since May 2000, and aim to be the best place to find and share science-related content of all kinds.

Share the love!

Please add more science to your life. Use our RSS feeds on your blog, your portal, or your favorite feedreader!


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000-2009 Hypography
Part of the Hypography - Science for Everyone Network