What's new
What's new

An Exercise In Macro Programing (Chaos Fractal)

MillGuy88

Aluminum
Joined
Mar 13, 2024
Location
Saskatoon
I've been working on an excercise in macro programing. I'm trying to recreate the growth/chaos fractal as seen in Veritasium's YouTube video and get my machine to plot it out. I'm not a software engineer or computer science person by any stretch of the imagination.

I can get it to plot out the basic growth rate over time, but I am struggling to get it to plot the fractal when I introduce gradually increasing the initial conditions/growth rate.

Instead of bifurcating and becoming chaotic, I can only get it to plot a single value after a set amount of maximum iterations or until it reaches a constant.

I've tried various strategies, but my program just keeps getting more and more complicated without any progress. There must be a simple solution that I'm overlooking.

I would also like to try and create a macro program to plot out the Mandelbrot Set also shown in the same video.

The machine controller I'm using is a TOSNUC 999 which is a Toshiba/Shibaura proprietary controller so it sets macro variables a little differently than Fanuc controllers, but it works essentially the same way.


Below is an example of the basic macro before I get lost.

[V1=40] (START POPULATION)
[V2=100] (MAX POPULATION)
[V3=100] (MAX # OF ITERATIONS)
[V4=0] (GROWTH RATE/X-AXIS)
[V5=4.] (MAX GROWTH RATE)
[V6=.015] (GROWTH RATE INCRIMENTS/RESOLUTION)

[V7=118.] (MACHINE MAX X-AXIS)
[V8=90.] (MACHINE MAX Y-AXIS)

( * DO NOT ALTER * )
N100
[V9=0] (ITERATION COUNT)
[V10=V1/V2] (% OF MAX POPULATION)

[V11=V4*[V10*[1-V10]]] (POPULATION GROWTH)
[V12=0] (SET V12/CONSTANT CHECK)

N101
[V9=V9+1] (ITERATION COUNT)
[V11=V4*[V11*[1-V11]]] (POPULATION GROWTH OVER TIME)

[IF,V11.EQ.0,GO,200]
[IF,V11.EQ.V12,GO,200] (CHECK FOR CONSTANT GROWTH RATE)
[V12=V11] (CHECK FOR CONSTANT)
[IF,V9.EQ.V3,GO,200] (ITERATION CAP CHECK)
[GO,-101]

N200( * PLOTTING * )
[VY=V11*V8]
[VX=[V4/V5]*V7]

G0 X[VX] Y[VY]

[IF,V4.EQ.V5,GO,300] (CHECK FOR GROWTH RATE CAP)
[V4=V4+V6] (INCREASE GROWTH RATE)
[GO,-100] (LOOP BACK WITH NEXT GROWTH RATE)

N300 (END OR MACRO)
 








 
Back
Top