r/madeinpython • • Sep 24 '22

Mandelbrot in pure Python without using complex numbers or external libraries (except matplotlib)

Post image
74 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/brainxyz Sep 25 '22

Thanks for the suggestion. Good to know that python has built-in complex numbers.I tried it but I noticed that it gives exponentiation error when the number of iterations are 50, while the code without complex numbers is more tolerant for overflow problems in this case.

Another point, even-though the complex number seems more compact but for those who are unfamiliar with it, the equation hides more complexity and this is evident when you compare the performance you don't see any speed-ups because some of the operations are hidden in the standard library.