Hello, I am trying to make a program to plot the Mandelbrot set fractal, but it doesn't look just right and I keep using up all my memory when I have about 22000 bits RAM free.
Here's what I have for the program now:
:0→Z:0→F
:0→N:0→C
:-1→Xmin:1→Xmax
:-1→Ymin:1→Ymax
:Shade(1X-5,1X+5)
:Lbl 1
:0→θ
:rand→N:rand→C
:(0+0i)→Z
:Repeat abs(Z)≥2 or θ=10
:Z²+(N+Ci)→F
:(F²+2F→Z
:1+θ→θ
:End
:If abs(Z)≥2
:Then
:Pt-Off (N,C)
:Goto 2
:Else
:Lbl 2
:0→θ
:-rand→N:rand→C
:(0+0i)→Z
:Repeat abs(Z)≥2 or θ=10
:Z²+(N+Ci)→F
:(F²+2F→Z
:1+θ→θ
:End
:If abs(Z)≥2
:Then
:Pt-Off (N,C)
:Goto 3
:Else
:Lbl 3
:0→θ
:rand→N:-rand→C
:(0+0i)→Z
:Repeat abs(Z)≥2 or θ=10
:Z²+(N+Ci)→F
:(F²+2F→Z
:1+θ→θ
:End
:If abs(Z)≥2
:Then
:Pt-Off (N,C)
:Goto 4
:Else
:Lbl 4
:0→θ
:-rand→N:-rand→C
:(0+0i)→Z
:Repeat abs(Z)≥2 or θ=10
:Z²+(N+Ci)→F
:(F²+2F→Z
:1+θ→θ
:End
:If abs(Z)≥2
:Then
:Pt-Off (N,C)
:Goto 1
:Else
:Goto 1
:End
I used the formula z=z²+c equation for the Mandelbrot set.
When my calculator has the Memory error I go in and remove the Shade( command so it will continue on with the picture instead of filling it back in.
Theta is used to limit the number of iterations that each point undergoes, stopping at 10 currently.
The points outside the Mandelbrot's pool(or beetle) are erased, in theory leaving the shape of his pool in black.
N is the x-coordinate of the point being tested, and C is the y-coordinate of the point. So you get z=z²+(N+Ci).
rand command is only positive, so I used -rand to change the quadrant the points were in.
If you have any way to save my memory while this program runs, or make it faster, or a better program altogether that would be greatly appreciated.
(Ti-84 Plus calculator)