Python Mandelbrot fractal - NumWorks 1.1.2 & 1.2.0 (cmath) comparison

Subscribers:
499
Published on ● Video Link: https://www.youtube.com/watch?v=_n_rL-U_kCg



Duration: 2:40
2,765 views
23


Mandelbrot fractal in Python.
On the left, the NumWorks 1.1.2 original program.
On the right, the same program adapted for the newer NumWorks 1.2.0 firmware, using a function and complex numbers (cmath module).

NumWorks 1.1.2 original code :
import kandinsky
N=10
for x in range(320)
for y in range(222)
zr=0
zi=0
cr=2.7*x/319-2.1
ci=-1.87*y/221+0.935
i=0
while i {less than} N and zr*zr+zi*zi {less than} 4
i=i+1
s=zr
zr=zr*zr-zi*zi+cr
zi=2*s*zi+ci
rgb=int(255*i/N)
col=kandinsky.color(int(rgb),int(.75*rgb),int(.23*rgb))
kandinsky.set_pixel(x,y,col)

Equivalent code for the newer firmware :
import kandinsky
def mandelbrot(N) :
for x in range(320):
for y in range(222):
z=complex(0,0)
c=complex(2.7*x/319-2.1,-1.87*y/221+0.935)
i=0
while i {less than} N and abs(z) {less than} 2:
j=j+1
z=z*z+c
rgb=int(255*i/N)
col=kandinsky.color(int(t),int(.75*t),int(.23*t))
kandinsky.set_pixel(x,y,col)

call with : mandelbrot(10)




Other Videos By Xavier Andréani


2018-10-02NumWorks N0100 + NES emulator : Zelda II intro
2018-02-27Nanoloader PoC #2 - TI-Nspire CX boot manager compatible CR4+ / W+ hardware
2018-02-27Nanoloader PoC - TI-Nspire CX boot manager compatible CR4+ / W+ hardware
2018-01-26TI-83 Premium CE + TI-Robot E3 : CATOBOT demo
2017-12-17NumWorks firmwares performance test : 1.2.0 vs 1.3.0
2017-12-09Graphic performance test #3/3 : NumWorks (Python) vs HP Prime (HPPPL non-CAS)
2017-12-09Graphic performance test #2/3 : NumWorks (Python) vs HP Prime (HPPPL CAS)
2017-12-09Graphic performance test #1/3 : NumWorks (Python) vs HP Prime (Python-like)
2017-12-08TI-Innovator Rover DNB 2017 Amérique du Sud : programme Scratch n°2
2017-12-08TI-Innovator Rover DNB 2017 Amérique du Sud : programme Scratch n°1
2017-12-05Python Mandelbrot fractal - NumWorks 1.1.2 & 1.2.0 (cmath) comparison
2017-11-24How to drag scrollbars elevators on TI-Nspire CX & TouchPad
2017-11-10Diams playthrough levels 1-5 (TI-83 Premium CE)
2017-11-10Ticket to ride - bot vs bot (TI-Nspire CX CAS)
2017-11-04TI-Innovator Rover demo program #3 [Dance] - APMEP 2017 Nantes
2017-11-02TI-Innovator Rover demo program #2 [Obstacles] - APMEP 2017 Nantes
2017-10-31TI-Innovator Rover demo program #1 [Shapes] - APMEP 2017 Nantes
2017-10-27TI-Nspire CX CAS + Hexpire : chapter #1 playthrough
2017-10-02Casio Graph 75+E : exam mode exit combo with modified OS (method #1)
2017-10-02Casio Graph 75+E : exam mode exit combo with modified OS (method #2)
2017-10-01NumWorks assembly with the external 8MiB Flash chip at U7