The p variable contains the computing of the square of z, which is also a complex number, please refer to this, to understand how basic operations such as addition, subtraction and multiplication works in complex numbers.The mandelbrot function receives a complex number, it has real and imaginary part, here we are representing those components as x and y.The number of iterations to reach a modulus greater than 2 can be used to determine the color to use when we are plotting.Ī complex plane can be represented in a normal 2D plane, where the X axis, will represent the real number, meanwhile the Y axis will represent the imaginary number, for instance, x = 3 y= 5i.įor a better understanding please refer to this video.įinally, after understand a bit of the Mandelbrot equation, it's time to implement it:Įnter fullscreen mode Exit fullscreen mode When the modulus of Zn is greater than 2, means that the number does not belong to Mandelbrot set, otherwise it is part of the set. Of a part of the complex plane, if Zn is bounded. To represent visually this set we need to find, for each point c In this entry you will learn how to plot in JS, the previous image.īut before, let's see a little more theory about how this set works.Īs we mention before, the mandelbrot set is defined in the set of complex numbers c for which the function,ĭoes not diverge when iterated from z = 0.īelow, the previous equation is broken down:Īs you can see, the Mandelbrot set is obtained from the quadratic recursive equation where, z and c represents a complex number. In the next picture you can see what I mean.įigure 1: Mandelbrot set - black and white ![]() In a nutshell, a mandelbrot set is one of the most beautiful and famous fractal, that is defined by the set of complex numbers. In general, a Mandelbrot set marks the set of points in the complex plane such that the corresponding Julia set is connected and not computable. Note: If you are not familiar with the mathematical terms used here, I recommend you to read about complex numbers and fractals.įirst of all, What a heck is a Mandelbrot Set?, according to mathworld:Ī Mandelbrot Set, is used to refer both to a general class of fractal sets and to a particular instance of such a set. ![]() In this entry I want to share with you, a little of my knowledge to show you how to plot a Mandelbrot Set without any library just JS, so go ahead!.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |