Jump to content

Recommended Posts

HELP!    I am trying to understand Atari 8-bit Fractals; I know what they are, I know where they come from and I understand COMPLEX numbers but I can't design my own Fractal program. I do have 1 prog. listed below but find it too complicated to understand... Any help please!!!

 

This is the initiation routine:

 

CX=160:CY=96

X=5.0001

Y  ??

LX= (i.e. 4.0005):LY=(i.e. 0.0005)      

S=LX*LX+LY*LY

LX=4*LX/S

LY=-4*LY/S

SC=(i.e. 25)

SC=(CX+CX)/SC

 

GRAPHICS 8+16: COLOR 1:POKE 710,0

 

main routine:

 

LOOP:

TX=X:TY=Y

X=TX*LX-TY*LY

Y=TX*LY+TY*LX

X=1-X: T=Y

S=SQR(X*X+Y*Y)

Y=SQR(ABS((S-X)/2))

J=S-X

IF J<0 THEN Y=-Y

X=SQR(ABS((S+X)/2))

J=S+X

IF J<0 THEN X=-X

IF T<0 THEN X=-X

IF RND(0)<0.5 THEN X=-X:Y=-Y

X=1-X

X=X/2

Y=Y/2

 

M=SC*(X-0.5)+CX

J=CY-SC*Y

TRAP LOOP BACK

PLOT M,J

 

LOOP BACK:

 

You don't necessarily have to understand all of this because I'd just like the necessary computations to create my own Fractal program.

 

Edited by ac.tomo

Share this post


Link to post
Share on other sites

Hi!

1 hour ago, ac.tomo said:

HELP!    I am trying to understand Atari 8-bit Fractals; I know what they are, I know where they come from and I understand COMPLEX numbers but I can't design my own Fractal program. I do have 1 prog. listed below but find it too complicated to understand... Any help please!!!

 

This is the initiation routine:

 

1 hour ago, ac.tomo said:

 

You don't necessarily have to understand all of this because I'd just like the necessary computations to create my own Fractal program.

 

 

Your program draws what is called "iterated function system fractals", where two (or more) functions are randomly applied to a point and you draw all points in the series.

 

See, this shorter version of your program:

image.thumb.png.080b40026ee5dd63bb2342c1d3319750.png

 

Produces this drawing:

image.thumb.png.1443dfba2da78c72a2f1dfd4c5569bdc.png

 

I simplified your formulas, because "J=S-X" and "J=S+X" are both always positive, and I removed those scaling factors.

 

By further simplifying your program, it can be made to plot the Julia fractal, here the iterated functions are F1(z)=sqrt(z-c) and F2(z)=-sqrt(z-c), you can chose the complex value of "c" with your variables LX and LY:

 

image.thumb.png.fb8d5ac8209e7d82c2710643a7be2c72.png

 

 

image.thumb.png.04edccadf323961aa67db4d77e73469b.png

 

 

Have Fun!

 

  • Like 3

Share this post


Link to post
Share on other sites

Thankyou ever so much DMSC, this is exactly what I was looking for, also though, can you help me with just a few other little things:

 

1. The chosen variable names such as LX,LY, S, TX,TY, why these names, do they represent any English 'word' meaning,

2. Are the Functions Calculous?

3. Can I just alter LX and LY in these 2 programs for other various Fractals, or have I to more complify the matter with more calculations?

 

lastly, you gave the functions for the Julia fractal program, but not the functions for the 1st (Mandelbrot prog I believe).

 

 

Edited by ac.tomo

Share this post


Link to post
Share on other sites

Hi!

4 hours ago, ac.tomo said:

Thankyou ever so much DMSC, this is exactly what I was looking for, also though, can you help me with just a few other little things:

 

1. The chosen variable names such as LX,LY, S, TX,TY, why these names, do they represent any English 'word' meaning,

I don't know, I suppose that "T" in TX/TY could stand for "temporary", and the "S" for "square-root", but who knows.

 

4 hours ago, ac.tomo said:

2. Are the Functions Calculous?

Don't really understand that question, sorry.

4 hours ago, ac.tomo said:

3. Can I just alter LX and LY in these 2 programs for other various Fractals, or have I to more complify the matter with more calculations?

By varying the "LX/LY variables you can choose a different Julia set, you can get very different shapes by using different parameters - but all of those are for the same fractal formula - the standard z²+c -> z.

 

4 hours ago, ac.tomo said:

 

lastly, you gave the functions for the Julia fractal program, but not the functions for the 1st (Mandelbrot prog I believe).

You can't really draw a mandelbrot fractal with an IFS formula, as the mandelbrot set has a different parameter for each point in the set. Don't know which formula your original program tried to draw, perhaps was some approximation to it. You can try modifying the formula and watch what it draws.

 

Have Fun!

 

Share this post


Link to post
Share on other sites

Thankyou all for your help, in order to create my own formulas (from a given function) I'm trying to write a program (to do both Mandelbrort and Julia curves) using the help and instructions from an article in Page-6's magazine issue #22 by Peter Coates, but do you think I can! I understand everything but just cant do my own program... Please, can anyone help!! Perhaps, if someone can write a program using these steps (something I can't do) with some REM's that would be Brill!

 

Edited by ac.tomo

Share this post


Link to post
Share on other sites

In issue 38 of Analog magazine, there is an article: "Fractals, An Introduction", by Alex Leavens that might add more information.

 

I think that there was an article in Antic as well.  I'll post it if I find it.  Found it.  Volume 4, Number 12.  April 86 issue.  "Fractals for Your Atari" and "Fractal Zoom" by Charles Jackson.  

Edited by Geister
Updating information.

Share this post


Link to post
Share on other sites

I've been through and read all relating articles in Page-6 NAU, Atari user, antic, analogue and some other sources and p6 issue #22 is the only one to explain the way to produce your own BASIC program. I've brought the article here and tried to create my own program but I need help:

Referring to Peter Coates' article:

 

using GRAPHICS 15;

 

step 1. ENTER N,M,X0,Y0,D

N=amount of pixels horizontally, thus N=160

M=amount of pixels vertically, thus M=192

X0 and Y0 are the co-ordinates of the bottom left hand corner, thus X0=0 and Y0=191

D=the interval between pixels in mathematical units, thus D=1

 

upper values of X and Y are:

XM=X0+(N-1)*D

YM=Y0+(M-1)*D

 

step 2. other values, ENTER P,Q

for the Julia set only, we enter the values for the COMPLEX constant C

for all patterns we set the value K for the maximum number of iterations (50-1000) and for the maximum amplitude L (10-100)

thus, L=50 and L=50

 

step 3. for each pixel, e.g.

FOR I=0 TO M-1

FOR J=0 TO N-1

 

set the loop counter which gives the value of K to 0

 

thus, COUNTER=0

 

now set the initial values for z(0) and C

 

for the Mandelbrot set;

XK=0, YK=0

P=X0+J*D

Q=Y0+I*D

 

for the Julia set;

XK=X0+J*D

YK=Y0+I*D

(P and Q already set)

 

start the iteration and calculate the next values:

 

START

XL=XK*XK-YK*YK+P

YL=2*XK*YK+Q

increment the COUNTER and reset the X, Y values for the next stage:

thus;

 

COUNTER=COUNTER+1

XK=XL:YK=YL

LOOP back if the magnitude of the new value is less then L and the maximum number of iterations hasn't been reached

thus; 

IF XK*XK+YK*YK<L AND COUNTER<K THEN GOTO START

 

step 4: Colour the pixel (I,J) according to the value of the COUNTER and the colouring rule, the colouring rule is just simply:

 

IF K<12 THEN COLOR 1

IF K>11 AND K<200 THEN COLOR 2

IF K>199 THEN COLOR 3

 

NEXT J

NEXT I

END

 

OK, there it is, if anyone can help me or see where I'm going wrong it would be most appreciated, thankyou.

 

Share this post


Link to post
Share on other sites
On 4/20/2020 at 10:49 AM, ac.tomo said:

 

Hi!

 

 This is about the simplest - and very slow! - Mandelbrot drawing in Atari BASIC:

 

10 GRAPHICS 15
20 FOR I=0 TO 80
30 FOR J=0 TO 159
40 X0=(J-100)*0.02:Y0=(I-80)*0.02
45 X=X0:Y=Y0:C=3
50 X2=X*X:Y2=Y*Y:C=C-0.2
55 IF X2+Y2>4 OR  NOT C THEN 70
60 Y=2*X*Y+Y0:X=X2-Y2+X0:GOTO 50
70 COLOR C+0.4:PLOT J,I:PLOT J,160-I
80 NEXT J
90 NEXT I

 

Have Fun!

 

Share this post


Link to post
Share on other sites

Hi!

On 4/20/2020 at 10:49 AM, ac.tomo said:

I've been through and read all relating articles in Page-6 NAU, Atari user, antic, analogue and some other sources and p6 issue #22 is the only one to explain the way to produce your own BASIC program. I've brought the article here and tried to create my own program but I need help:

Referring to Peter Coates' article:

And this is a FastBasic program similar to the above (but with a slightly better zoom and coloring):

 

GRAPHICS 15+16
' Iterate over all the pixels in the top half of screen
FOR I=0 TO 95
  FOR J=0 TO 159
    ' Set Z0 from coordinates in the screen
    X0%=(J-100)*0.024
    Y0%=(I-95)*0.012
    ' And start with Z = Z0
    X%=X0%:Y%=Y0%
    ' Perform up to 15 iterations
    FOR C=15 to 1 STEP -1
      ' Check if Z is outside the circle of radius 2
      X2%=X%*X%:Y2%=Y%*Y%
      IF X2%+Y2% > 4 THEN EXIT
      ' Update new value:  Z = Z^2 + Z0
      Y%=2*X%*Y%+Y0%
      X%=X2%-Y2%+X0%
    NEXT
    ' This set color to 0 only if C is 0.
    COLOR 1 + (C-1) MOD 3
    ' Plots point and the mirror on the bottom half
    PLOT J,I:PLOT J,190-I
  NEXT
NEXT

 

Have Fun!

 

Share this post


Link to post
Share on other sites
16 hours ago, dmsc said:

Hi!

 

 This is about the simplest - and very slow! - Mandelbrot drawing in Atari BASIC:

 

10 GRAPHICS 15
20 FOR I=0 TO 80
30 FOR J=0 TO 159
40 X0=(J-100)*0.02:Y0=(I-80)*0.02
45 X=X0:Y=Y0:C=3
50 X2=X*X:Y2=Y*Y:C=C-0.2
55 IF X2+Y2>4 OR  NOT C THEN 70
60 Y=2*X*Y+Y0:X=X2-Y2+X0:GOTO 50
70 COLOR C+0.4:PLOT J,I:PLOT J,160-I
80 NEXT J
90 NEXT I

 

Have Fun!

 

Thanks again, I have 1 last question to ask (noooo I hear you say, lol). Does the program have to use FOR/NEXT loops, for example; could I replace lines 20 and 30 with 20 I=RND(0)*81 and 30 J=RND(0)*160 or does it matter if the same Random value were chosen more than once. I would love to have a Mandelbrot Fractal that didn't use FOR/NEXT loops. OK then, that's it, I promise I won't ask anything else, you've all (well mostly DMSC) been absolutely brilliant and I am most appreciative. Thankyou.

Share this post


Link to post
Share on other sites

Why does it matter whether it uses for next loops? Just wondering. If what you really mean is 'it needs to be faster' there's probably more than that which could be done.

Share this post


Link to post
Share on other sites

Hi!

7 hours ago, ac.tomo said:

Thanks again, I have 1 last question to ask (noooo I hear you say, lol). Does the program have to use FOR/NEXT loops, for example; could I replace lines 20 and 30 with 20 I=RND(0)*81 and 30 J=RND(0)*160 or does it matter if the same Random value were chosen more than once. I would love to have a Mandelbrot Fractal that didn't use FOR/NEXT loops. OK then, that's it, I promise I won't ask anything else, you've all (well mostly DMSC) been absolutely brilliant and I am most appreciative. Thankyou.

The program uses the FOR loops to go through all the pixels in the screen, then for each pixel it tests if it is outside the mandelbrot set (whenever x²+y²>2²) or probably inside (when 15 iterations have passed and the point remained inside).

 

If you replace the FOR loops with random pixels then each random pixel will be tested and painted accordingly. But, you will need a lot of those pixels to be drawn to get the full set.

 

It is not possible to get an iterative-inverse-function for drawing the mandelbrot set (as the Julia set at the first posts). Probably there is a proper approximation of finding the inverse mapping of the unit circle to the points in the boundary - but I don't know it. You could ask at https://math.stackexchange.com/ , there are many mathematicians that could answer you there.

 

Have Fun!

 

Share this post


Link to post
Share on other sites

Mega Magazine #3 has my article and source code on side B of the disk. Keep in mind I was a kid when I wrote that ;)

Share this post


Link to post
Share on other sites
On ‎4‎/‎23‎/‎2020 at 12:59 AM, dmsc said:

Hi!

 

 This is about the simplest - and very slow! - Mandelbrot drawing in Atari BASIC:

 

10 GRAPHICS 15
20 FOR I=0 TO 80
30 FOR J=0 TO 159
40 X0=(J-100)*0.02:Y0=(I-80)*0.02
45 X=X0:Y=Y0:C=3
50 X2=X*X:Y2=Y*Y:C=C-0.2
55 IF X2+Y2>4 OR  NOT C THEN 70
60 Y=2*X*Y+Y0:X=X2-Y2+X0:GOTO 50
70 COLOR C+0.4:PLOT J,I:PLOT J,160-I
80 NEXT J
90 NEXT I

 

Have Fun!

 

Enter the above program, but omit lines 10, 20, 30, 80 and 90, then add:

 

95 RETURN

5 GOTO 100

100 DIM S$(160*96)

105 S$(1)="1":S$(160*96)=S$(1)

115 S$(2)=S$(1)

120 QX=1:QY=1

125 GR. 15+16

140 J=INT(RND(0)*159)+1

145 I=INT(RND(0)*95)+1

150 P=J-1+I*160-159

155 IF S$(P,P)="0" THEN 180

160 S$(P,P)="0"

165 GOSUB 40

170 GOTO 140

180 IF QX>159 THEN QX=1:QY=QY+1:IF QY>95 THEN 300

190 P=QX-1+QY*160-159

192 IF S$(P,P)="1" THEN J=QX:I=QY:GOTO 160

195 QX=QX+1

200 GOTO 180

300 GOTO 300

 

That's it. It's the same FRACTAL program except my program picks each pixel randomly and if in the case a random pixel is picked twice then it starts filling in the picture from the top left of the screen onward to the bottom right, filling in unused pixels. I've done it this way because you can see the progress of the fractal coming together a lot quicker, even though it does still take the same amount of time to finish.

 

Share this post


Link to post
Share on other sites
On ‎4‎/‎25‎/‎2020 at 3:11 PM, ivop said:

Mega Magazine #3 has my article and source code on side B of the disk. Keep in mind I was a kid when I wrote that ;)

 

Anyone know where I can get copies of Mega Magazine from?

Share this post


Link to post
Share on other sites

I now understand fractals much more than I used too thanks to DMSC and this forum. I do have another, well, not so much a question, but a difference:

would I be right in saying:

 

Mandelbrot:

X0=0:Y0=0

P=J*0.02   - J being the vertical pixel

Q=I*0.02   - I being the horizontal pixel

 

OR Julia:

X0=J*0.02

Y0=I*0.02

with P and Q equal to X and Y

 

with:

 

LOOP

X2=X0*X0-Y0*Y0 +P and

Y2=2*X0*Y0+Q

 

then;

 

X0=X2

Y0=Y2

LOOP

 

 

Would this be the correct difference between the Julia and Mandelbrot formulas? I do apologise if it seems like another question but it's just a little thing I haven't quite calculated. Again, thanks for your pursuance. I promise not to ask anything else!

Edited by ac.tomo

Share this post


Link to post
Share on other sites

Hi!

48 minutes ago, ac.tomo said:

You are miss-reading the Scientific American article. It states:

Quote

The Mandelbrot set is the set of all complex numbers c for which the size of z² + c is finite even after an indefinitely large number of iterations.

 

This means that, for each point that you want to ask: is this point "c" part of the Mandelbrot set? , you need to perform a large number of iterations "z -> z²+c" and test if |z| is finite. Is has been proved that to test if |z| not finite, it is enough to test that |z| > 2.

 

In pseudo-code:

 

-  For each pixel (x,y) in my picture:

--  Get the value of "c" for this pixel, c = scale * (x,y) - center

--  Set z = 0

--  For a number of iterations:

--- Set z <- z²+c

--- If |z| > 2, the point "c" was outside the Mandebrot set, exit the loop.

--- If |z| < 2, keep iterating.

-- Pick a color and point it into the pixel: black if after all iterations |z| < 2 , any other color otherwise.

-- Go test the next pixel.

 

Remember, the Mandelbrot set is the *black* area in all those drawings, the colors are simply to produce a good looking image.

 

Have Fun!

 

  • Like 3

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...