How to Code the Mandelbrot Set 2

Published on Oct 11th 2021Duration: 30:39Watch on YouTube

The Mandelbrot Set is one of the most incredible things I've ever witnessed in life. This is part 2 of a 2 part series where I share it with Huiqi and you. I give a step by step tutorial for how to create a Mandelbrot Set visualization yourself, using nothing by HTML and JavaScript. Enjoy! If you'd like, the source code produced in the episode can be found at https://github.com/airportyh/thumbprint-of-god

Transcript

The following transcript was automatically generated by an algorithm.

• 00:01 : i tried all kinds of
• 00:03 : prints like i went to fedex
• 00:06 : and i used their
• 00:08 : higher quality printers
• 00:10 : some photo printing as well
• 00:13 : the larger paper
• 00:15 : oh i don't know if you can see the
• 00:17 : quality from here
• 00:19 : the print quality is really good that's
• 00:22 : what i was going for so so like i i'm
• 00:24 : making a website that lets people print
• 00:27 : out posters like these so that part has
• 00:30 : been figured out i think maybe you
• 00:32 : cannot have like a store that sells like
• 00:35 : t-shirts and
• 00:38 : so yeah last time we ended up with this
• 00:41 : uh where
• 00:45 : point on your cursor
• 00:47 : we're canceling out the
• 00:49 : sort of vertical axis
• 00:51 : we're ignoring that for the moment so
• 00:53 : it's always plotted at the middle
• 00:54 : vertically but
• 00:56 : we start at the point that your pointer
• 00:59 : is pointing to
• 01:01 : and then
• 01:02 : use that as the c
• 01:04 : in this equation f of c
• 01:07 : of z
• 01:10 : is z squared plus c
• 01:15 : z
• 01:15 : is equal to zero
• 01:18 : we get the calculation and then we take
• 01:20 : the result and feed it back into z and
• 01:23 : do it again and we do it iteratively and
• 01:26 : the idea is we want to figure out if it
• 01:29 : goes to infinity or not there's a
• 01:30 : theorem that tells us if at any point in
• 01:33 : time the output goes outside of this two
• 01:36 : by two circle then we know for a fact
• 01:40 : that it will go into infinity so anyway
• 01:42 : that's what's going on so this is each
• 01:44 : iteration this is iteration 0 this is
• 01:48 : iteration 1
• 01:50 : iteration 2 etc
• 01:53 : we put this label element here let's
• 01:56 : make use of it let me uh
• 02:01 : play block so it'll be placed nicer
• 02:06 : and i'll give you the background
• 02:08 : color
• 02:10 : of light yellow
• 02:12 : and then we will display
• 02:18 : t e c r
• 02:24 : and the ci
• 02:29 : on the label
• 02:31 : there it is it's kind of too long but
• 02:33 : i'm not gonna bother fixing it last time
• 02:35 : you asked me is it true that um if it's
• 02:38 : less than one then it'll go to zero
• 02:41 : right and i sort of wanna answer why
• 02:44 : that's not the case if you take c equals
• 02:47 : to zero point five for example
• 02:50 : so c is 0.5 0 squared is 0. initially we
• 02:55 : get
• 02:56 : just c which is 0.5 and we plug it back
• 02:59 : in
• 03:01 : this time we're going to do
• 03:03 : 0.5 times 0.5 for z squared which is
• 03:07 : going to be 0.25
• 03:10 : and that part gets smaller the problem
• 03:13 : is we have to add add it back to the
• 03:16 : original c oh okay i see that's going to
• 03:19 : make it bigger so
• 03:20 : so just by being smaller than one
• 03:24 : doesn't make it go to zero
• 03:27 : needs to be a really tiny number okay
• 03:31 : um for for it not to go to infinity one
• 03:34 : thing i want to do before we go to 2d
• 03:36 : really quick is because the mandelbrot
• 03:38 : sets definition is the set of complex
• 03:41 : number c for which if you do this
• 03:44 : iteration of this equation it will not
• 03:47 : eventually go to infinity the c is my
• 03:50 : pointer basically c is where my pointer
• 03:53 : is what we could do to visualize the
• 03:55 : mandelbrot set is to color the point
• 03:58 : black if it is in the set it doesn't go
• 04:00 : to infinity and to not color it if it
• 04:03 : does go to infinity so leave it be white
• 04:06 : and that's how you get the shape of the
• 04:08 : mandelbrot set
• 04:10 : maybe i can just do that for the real
• 04:13 : numbers to show you what that might look
• 04:15 : like so instead of generating these
• 04:17 : color bubbles i'm just going to say
• 04:19 : after going through these 100 iterations
• 04:23 : is the number
• 04:24 : greater than 2 because if at any point
• 04:28 : in time you go outside of this circle
• 04:31 : then it will for sure go to infinity if
• 04:33 : it is greater than two then we're gonna
• 04:35 : plot the point
• 04:38 : uh otherwise we will not plot the point
• 04:41 : so i move that code that plots the point
• 04:43 : in inside this if statement oh so one
• 04:46 : question so after you look through it
• 04:49 : for a hundred times then you plot the
• 04:52 : point in the original
• 04:55 : yeah
• 04:56 : yeah in the original place but we we
• 04:58 : don't plot the point that's like going
• 05:00 : towards the infinity we plot the point
• 05:02 : from the original place wait a minute
• 05:04 : let me see if this works
• 05:09 : oh i should say the reverse if it's
• 05:11 : still inside two i want it to be black
• 05:14 : it didn't go to infinity at least for
• 05:16 : the number of times we've tried if i
• 05:18 : just don't clear the canvas every time
• 05:22 : then i leave a trail
• 05:25 : for the places on the real number line
• 05:29 : that are inside the mandelbrot set
• 05:31 : starting negative 2 which is all the way
• 05:33 : at the
• 05:34 : left side of the canvas to this point
• 05:37 : here which is about
• 05:39 : 0.264 more than that it goes to infinity
• 05:43 : so basically in order to pin this black
• 05:46 : line you have to go through
• 05:49 : uh the whole
• 05:50 : horizontal boundary in your canvas in
• 05:53 : order to figure out which one goes to
• 05:56 : infinity which one doesn't exactly now
• 05:59 : i'm going to revert back and now we're
• 06:01 : going to do two dimensions now we're
• 06:04 : going to do imaginary dimension as well
• 06:06 : how do we do that um i want to give you
• 06:08 : an example of how you would do it by
• 06:11 : hand let's say the point 1 1 1 1 means c
• 06:16 : the constant c is equal to 1
• 06:19 : plus
• 06:20 : i i is just 1 times i if we iterated
• 06:23 : this equation which is
• 06:26 : that so f of
• 06:28 : 1 plus i
• 06:31 : starting at 0.
• 06:34 : is going to be zero squared which is
• 06:36 : still zero
• 06:38 : like the zeroth one you always ignore
• 06:40 : the z squared because it's going to be
• 06:42 : zero
• 06:43 : so that the first one is just going to
• 06:45 : be one
• 06:46 : plus
• 06:46 : i
• 06:48 : and then we feed that back into here
• 06:58 : so this is going to be 1 plus i
• 07:01 : squared
• 07:02 : plus 1 plus i
• 07:05 : right and how do you calculate that well
• 07:08 : you eat this part
• 07:12 : we do the
• 07:13 : we distribute
• 07:15 : the
• 07:16 : multiplication if you pair this one with
• 07:19 : this one
• 07:20 : then you pair this one with the i which
• 07:23 : is plus i and then you pair this i with
• 07:26 : this one
• 07:28 : which is another i
• 07:30 : and then the two eyes get paired
• 07:32 : together
• 07:34 : which is i squared
• 07:36 : what's the value of i squared oh it's
• 07:39 : negative one yeah exactly it's negative
• 07:42 : one
• 07:43 : because i is the square root of negative
• 07:46 : one
• 07:47 : so we end up with two
• 07:49 : i one
• 07:51 : plus two i
• 07:52 : minus one oh the ones cancel out
• 07:56 : so we just get 2i at the end
• 08:00 : and then this whole thing is 2i and
• 08:02 : we're going to add 1 plus i
• 08:05 : it's going to be uh
• 08:07 : 1
• 08:09 : plus 3i
• 08:11 : that's the answer
• 08:12 : for for this one and 1 plus 3i if we
• 08:16 : were to plot it on the canvas is
• 08:18 : basically the dot
• 08:21 : 1 3. we started with 1 1 and then we get
• 08:26 : and we ended up with one three it's all
• 08:29 : the way up there somewhere
• 08:31 : uh
• 08:33 : where this manual is
• 08:35 : that kind of took a while so i won't
• 08:37 : keep going but but if you kept going i
• 08:40 : if you did it one more time you will end
• 08:42 : up at negative seven seven which is kind
• 08:44 : of crazy because that's all the way over
• 08:47 : there so it started here and it went up
• 08:50 : there and then
• 08:52 : flew all the way back there
• 08:54 : that's kind of great but let's get the
• 08:56 : general equation of this thing let's say
• 08:59 : z was a plus b we need to be able to
• 09:03 : perform
• 09:04 : z squared how do we do z squared well z
• 09:07 : squared is going to be a plus b
• 09:11 : times i
• 09:13 : squared
• 09:15 : which is going to be
• 09:20 : we're going to
• 09:24 : break those terms out and then we're
• 09:26 : gonna do the distribution thing a gets
• 09:29 : paired with a and then a gets paired
• 09:32 : with
• 09:33 : bi
• 09:34 : and then this gets paired with a
• 09:38 : and then the two bis get paired with
• 09:41 : each other so it's gonna be b squared
• 09:44 : and then i squared
• 09:46 : these two guys become two times a
• 09:50 : b i
• 09:52 : and then
• 09:53 : this guy just becomes negative
• 09:56 : b squared so the end result is this
• 10:01 : and if you take a look at what the real
• 10:04 : part is and what the imaginary part is
• 10:07 : um
• 10:08 : the real part is these two combined
• 10:11 : right and that's the imaginary part
• 10:14 : so
• 10:15 : we call it maybe the
• 10:17 : new a
• 10:18 : a prime or something a prime is going to
• 10:21 : be
• 10:22 : a squared minus b squared
• 10:25 : and then the b prime the new the new
• 10:28 : sort of imaginary number
• 10:30 : is going to be 2 times a
• 10:33 : b and then we don't write the i because
• 10:36 : we just want the b part so so actually
• 10:38 : that's the equation of of of just
• 10:40 : squaring it
• 10:42 : and then and then we still want to add
• 10:44 : the c's real part
• 10:47 : and then add c's i part to complete this
• 10:50 : equation oh
• 10:52 : where the c part i kind of get lost oh
• 10:55 : okay so so before adding the c we're
• 10:58 : just doing z squared
• 11:00 : oh okay
• 11:01 : assuming z was a plus b i
• 11:05 : oh okay so this is the answer of the
• 11:08 : sort of the z squared
• 11:10 : right but then because the equation
• 11:12 : wants us to add c
• 11:14 : so we tag on the c part the real real
• 11:17 : part of the c goes into a prime which is
• 11:21 : the real part of the original number
• 11:24 : and then we add the imaginary part of
• 11:26 : the c as well
• 11:30 : so these two equations are what we're
• 11:32 : going to use
• 11:34 : in our iteration now
• 11:37 : and i'll show you that so now before we
• 11:39 : were just ignoring the imaginary part
• 11:41 : we're going to bring it back
• 11:43 : and before we were just using the
• 11:46 : half of the height now we're actually
• 11:48 : going to use the coordinate of the y
• 11:51 : from the mouse and that's going to go in
• 11:53 : here so c should have a correct value
• 11:57 : based on this screen to world
• 11:59 : function and here now we're going to
• 12:02 : have two equations
• 12:04 : we're going to say this one is like the
• 12:07 : a prime
• 12:08 : and this one is like the b prime
• 12:10 : actually
• 12:12 : we need to be careful
• 12:13 : and have a separate one
• 12:17 : have a separate one because we don't
• 12:19 : want to override the original one until
• 12:21 : both of the calculations are done i have
• 12:24 : made that mistake many times so you have
• 12:26 : to cache them before
• 12:28 : overwriting
• 12:29 : the current variable
• 12:31 : [Music]
• 12:32 : so this should be
• 12:35 : a squared minus b squared which would be
• 12:38 : same as
• 12:39 : zr
• 12:40 : squared
• 12:42 : minus zi squared
• 12:46 : so
• 12:47 : and then plus the cr
• 12:49 : that's what i had over here and then for
• 12:52 : the the b prime which in the code is zi
• 12:57 : is 2 times
• 12:59 : a times b
• 13:01 : and then plus c i which is just 2 times
• 13:04 : dr times zi
• 13:07 : plus ci okay
• 13:09 : see if that works
• 13:13 : oh no that did not work oh i know why i
• 13:16 : didn't swap into zi
• 13:18 : to be plotted we were ignoring it before
• 13:22 : and now we get this
• 13:24 : hey
• 13:25 : oh let me see this swirl
• 13:28 : yeah the swirls are pretty amazing uh if
• 13:31 : i stick to the
• 13:33 : real number line like i just put my
• 13:36 : pointer on the center you still get what
• 13:38 : you saw before
• 13:40 : this is this is kind of
• 13:43 : uh we can still if i align it correctly
• 13:46 : it'll still all line up as long as my
• 13:50 : mouse is exactly on the
• 13:53 : center
• 13:54 : but the moment you move a little bit
• 13:56 : from the center
• 14:00 : then crazy stuff can happen
• 14:02 : um but also
• 14:05 : depend on where you
• 14:07 : move your mouse
• 14:09 : interesting
• 14:10 : patterns
• 14:12 : can form like sometimes you have this it
• 14:15 : goes back to the same five spots
• 14:17 : phenomenon sometimes two spots sometimes
• 14:20 : it's four spots
• 14:22 : but then in between oh look at that star
• 14:26 : um this is like it's at one point it's
• 14:29 : going back to those same spots but
• 14:33 : sort of around that point
• 14:35 : you can sort of see it's like converging
• 14:38 : to those spots and then it's like
• 14:40 : drawing these streaks or spirals around
• 14:43 : those spots
• 14:46 : this this one looks like there's three
• 14:48 : spots
• 14:50 : and then there's three spirals coming
• 14:52 : out of three spots and that i mean just
• 14:55 : looking at this
• 14:57 : is fascinating like i could play with
• 14:59 : this for a long time here
• 15:01 : oh i look at that one
• 15:05 : some of the times you can see when it
• 15:07 : goes like this you know it went to
• 15:10 : infinity when it goes crazy you know
• 15:12 : it's going to infinity
• 15:14 : but when there's this sort of pattern
• 15:17 : it's probably staying in
• 15:19 : it it's like sort of bouncing back and
• 15:21 : forth within this restricted area and
• 15:24 : can't get out it feels like and and
• 15:27 : that's those are the points where it's
• 15:29 : within the mandelbrot set it's not going
• 15:31 : to infinity here we're inside the set
• 15:35 : and then
• 15:37 : and we're still inside the set we're
• 15:39 : still inside the set
• 15:41 : you can sort of feel out
• 15:43 : hey in this
• 15:44 : spot it's in the set and then here boom
• 15:47 : it went off it's not in the set anymore
• 15:49 : and then it's like oh okay you can kind
• 15:52 : of feel out which areas are in the set
• 15:55 : and which areas are not in the set but
• 15:57 : you could also just plot a dot there
• 16:00 : black
• 16:01 : if it's in the set so let's do that
• 16:02 : again
• 16:06 : for
• 16:06 : the for the complex numbers now this
• 16:09 : time
• 16:10 : i actually have to calculate the
• 16:12 : distance from the center because there's
• 16:14 : two coordinates now
• 16:17 : um to calculate the distance from the
• 16:19 : center we're gonna add their squares and
• 16:21 : then do the square root of that
• 16:24 : number
• 16:25 : so the distance from the center is going
• 16:27 : to be
• 16:29 : zr times zr plus zi times zi
• 16:33 : so squaring both of them and then take
• 16:36 : the square root of that that gives us
• 16:38 : the distance to the center
• 16:40 : and i'm going to say if the distance to
• 16:41 : the center is less than two
• 16:45 : i'm gonna paint it black
• 16:47 : okay
• 16:48 : i'm not going to clear the canvas every
• 16:51 : time so we can kind of see the residue
• 16:55 : and i can
• 16:57 : i can finger paint
• 17:02 : the great reveal of the mandelbrot set
• 17:07 : it looks a little bit like a beetle yeah
• 17:10 : right a bug of some sort but yeah
• 17:13 : obviously i mean this is a too tedious
• 17:15 : to do so what you might want to do is
• 17:18 : just
• 17:19 : extract this code out
• 17:21 : and just say uh
• 17:23 : plot inset maybe
• 17:34 : move it out and then
• 17:36 : double check it still works and then we
• 17:38 : can
• 17:39 : loop through all pixels on the canvas
• 18:01 : and let it do it automatically
• 18:07 : there we go
• 18:08 : okay
• 18:09 : um
• 18:10 : that still looks like a kids painting
• 18:13 : when we plot the dot
• 18:15 : we can use a smaller radius because we
• 18:18 : were using five as the radius now let's
• 18:21 : just use uh one as the radius
• 18:24 : and maybe we'll get a finer picture
• 18:27 : that's what the mandelbrot set looks
• 18:29 : like why those are there are dots like
• 18:32 : separated from the main image oh yeah
• 18:35 : these little dots um there's actually
• 18:37 : points here that are still inside the
• 18:39 : set even though it's separated from the
• 18:42 : main body it might be connected actually
• 18:45 : i'm not totally sure there's there are
• 18:48 : actually these
• 18:49 : antennas these very thin antennas that
• 18:52 : that come out from this bulb here
• 18:55 : and then connect with these little dots
• 18:57 : and those dots if you zoom into it it
• 18:59 : also looks like the speed holding
• 19:03 : smaller versions of the mandelbrot set
• 19:06 : now let's talk about coloring though so
• 19:07 : you asked last time what do the colors
• 19:10 : represent um there's multiple ways to
• 19:12 : color the mandelbrot set but basically
• 19:15 : it has to do with how many times did you
• 19:17 : have to iterate before it went outside
• 19:21 : that circle of that two radius circle
• 19:23 : for example
• 19:25 : if i only did one iteration
• 19:27 : instead of 100
• 19:29 : and i rerun this algorithm
• 19:32 : we would just get a black circle
• 19:35 : okay if i did two we get this little
• 19:37 : oval and then
• 19:40 : three it looks like a pair
• 19:42 : um
• 19:43 : this one looks like a stingray
• 19:45 : um
• 19:47 : this looks even more like a stingray so
• 19:49 : so the more iterations you do the more
• 19:52 : it resembles the actual mandelbrot set
• 19:54 : one simple way to color it that also
• 19:57 : gives really nice looking results
• 20:00 : is simply color each one of these case
• 20:04 : with a different color
• 20:08 : i can
• 20:09 : move this distance check
• 20:11 : inside of the loop
• 20:13 : and say if you already went outside side
• 20:16 : of the circle i can just come out of the
• 20:19 : loop right away first of all
• 20:22 : and then i'm gonna color you with this
• 20:24 : current k
• 20:27 : so it each each layer will be colored a
• 20:29 : different color i'm not even gonna use
• 20:32 : this i'm just going to calculate a color
• 20:36 : using a color from my color palette
• 20:39 : based on this k
• 20:41 : and then i'm going to
• 20:43 : just uh
• 20:45 : set the color to that color and then i'm
• 20:48 : going to plot the point
• 20:51 : the original xy not not the points that
• 20:54 : are bouncing around
• 20:56 : um
• 21:00 : so if it if it sort of went outside the
• 21:03 : circle we're gonna plot that color and
• 21:05 : be done and skip this part but it if it
• 21:08 : didn't
• 21:09 : go after all of these iterations it
• 21:11 : still didn't go outside the circle it'll
• 21:14 : come down here and color the point black
• 21:17 : at that point
• 21:18 : um i'm not gonna even bother checking
• 21:21 : anymore here because
• 21:23 : if if it was outside the circle it would
• 21:26 : have
• 21:26 : returned at this point let's see if that
• 21:29 : works yeah
• 21:31 : so
• 21:32 : yeah so now i have only done five
• 21:35 : iterations but uh we pump that up to 100
• 21:38 : iterations
• 21:41 : then we get that
• 21:43 : okay
• 21:45 : yep so so that's a very simple coloring
• 21:48 : method that also looks really good
• 21:50 : nice the last thing that i wanted to
• 21:53 : show you is how can you zoom in how can
• 21:56 : you pick like a coordinate and then zoom
• 21:59 : in
• 22:01 : i am going to
• 22:02 : i'm gonna bring back this code here
• 22:12 : so i brought back the code that will
• 22:15 : show you the coordinate um of the mouse
• 22:18 : but in the world coordinate for example
• 22:21 : i know zero zero is in the belly of the
• 22:24 : beetle somewhere here but this allows us
• 22:27 : to read out
• 22:29 : the coordinates so we can introduce a
• 22:32 : origin we can say i want the canvas to
• 22:35 : be centered on a certain point so
• 22:39 : if we had that we would be able to shift
• 22:42 : the image up and down or left and right
• 22:45 : right
• 22:46 : right let's do that so i'm going to say
• 22:48 : there's going to be a origin
• 22:50 : in the real direction
• 22:52 : and the origin
• 22:54 : in the eye direction let's say go into
• 22:57 : this antenna
• 22:59 : looking thing right
• 23:00 : i'm going to zoom in there let's see
• 23:03 : we already have a scale factor which
• 23:05 : will control the zoom in by the way like
• 23:08 : if i do that
• 23:09 : we zoomed in so we already can control
• 23:12 : this scale factor which will allow it to
• 23:14 : zoom in
• 23:15 : but but having the origin will allow us
• 23:18 : to shift
• 23:20 : up and down and zoom into the exact
• 23:22 : point that we want to zoom in to
• 23:24 : so i'm going to say hey i want to zoom
• 23:26 : into this coordinate here which is
• 23:28 : negative 0.112
• 23:32 : and 0.928
• 23:37 : i want to zoom in here how do i make it
• 23:39 : do that uh well all we have to do is
• 23:41 : change these uh coordinate conversion
• 23:44 : functions over here currently our origin
• 23:47 : is effectively zero zero right
• 23:50 : like let's say if x and y were 250 250
• 23:55 : we would end up with zero zero here
• 23:58 : but i don't want the center to be zero
• 24:00 : zero i want the center to be
• 24:02 : my origin numbers so i just add it to
• 24:05 : here my origin r
• 24:08 : and my origin
• 24:11 : i i just add them here
• 24:15 : and the inverse is true here i want to
• 24:18 : subtract origin r from here before the
• 24:22 : calculation and i want to subtract the
• 24:24 : origin i from here does that make sense
• 24:26 : yep okay now let's see if we can center
• 24:30 : it on that antenna
• 24:34 : yeah
• 24:35 : we're centered on the antenna now and
• 24:37 : now if we want to zoom in we just uh
• 24:40 : make this scale factor
• 24:43 : smaller and we're going to zoom in to it
• 24:46 : yep there it is
• 24:48 : we're gonna zoom in much more
• 24:51 : one over three thousand
• 24:54 : and we really get to see the details of
• 24:56 : the antenna
• 24:58 : yeah there's the antenna you can see
• 25:00 : these tiny little mandelbrots these
• 25:03 : beetle looking things they are
• 25:06 : everywhere if you zoom into the
• 25:08 : mandelbrot set so we'll take one of them
• 25:10 : and try to center on it so these are the
• 25:13 : separated dots
• 25:15 : yes exactly these are the separated dots
• 25:18 : that's yeah
• 25:19 : and uh they're disconnected
• 25:22 : from the main body by these little thin
• 25:25 : antennas so let's try zooming in
• 25:28 : 0.1276 repeating
• 25:33 : six a lot of sixes okay
• 25:36 : and then 0.987
• 25:40 : and then three repeating
• 25:42 : [Music]
• 25:48 : i think it's this little one there's a
• 25:49 : bigger one over here but i think we
• 25:51 : centered on this small one but then we
• 25:53 : can zoom into it even further
• 25:56 : okay
• 25:59 : yep that's our little beetle and now we
• 26:01 : can zoom into it even more
• 26:04 : if we want
• 26:06 : yeah
• 26:08 : that's our little guy
• 26:09 : so yeah that's how you generate
• 26:11 : mandelbrot set images and the
• 26:16 : is this image is effectively infinite
• 26:21 : theoretically you can zoom into it
• 26:24 : infinitely and there's infinite detail
• 26:27 : inside of it i'll show you the project
• 26:30 : that i've been working on which has a
• 26:32 : better zoomer we can zoom back into the
• 26:35 : little beetle
• 26:36 : that we were looking at which was
• 26:39 : probably this one over here
• 26:42 : nice
• 26:43 : of course
• 26:45 : yeah it's
• 26:46 : this this interface is like google earth
• 26:49 : and
• 26:50 : and it progressively gets more and more
• 26:52 : detail and at this point like it has a
• 26:56 : lot of detail but the thing about it is
• 26:59 : you can continue to zoom in even even
• 27:01 : when you think you've seen
• 27:03 : so at the end
• 27:04 : but no it's not the end you can keep
• 27:07 : zooming in
• 27:08 : and then and then he's like
• 27:10 : oh look there's another even tinier
• 27:13 : beetle
• 27:14 : on the inside
• 27:15 : then you can zoom in more
• 27:17 : and then and then like no there's still
• 27:20 : no end you can even zoom in even more
• 27:23 : there's even like what is what is this
• 27:26 : little coral looking thing
• 27:30 : and then and then you can even continue
• 27:32 : zooming in and find the detail uh
• 27:35 : theoretically
• 27:36 : like this image is
• 27:39 : infinite has infinite resolution
• 27:42 : as in you can continue zooming in and
• 27:44 : there's still more details at a finer
• 27:47 : level
• 27:48 : but we are limited by the computer's
• 27:51 : precision and the computer numbers can
• 27:54 : only have remember so many digits per
• 27:57 : number
• 27:58 : right and we're gonna run out of those
• 28:00 : and at that point things do get
• 28:03 : pixelated now it is possible still to
• 28:06 : implement
• 28:07 : unlimited precision numbers to get
• 28:11 : around this problem
• 28:12 : so that you can still calculate
• 28:15 : the image even at this zoom level but uh
• 28:18 : that is gonna make everything extremely
• 28:21 : slow and i i did not want to do that for
• 28:24 : for this zooming user interface
• 28:27 : okay but there are people who
• 28:29 : work on this as their hobby and what
• 28:31 : they do is
• 28:33 : they just run a job to have the computer
• 28:36 : calculate you know the image at a very
• 28:38 : very deep level
• 28:40 : the job is just gonna run for a long
• 28:42 : time
• 28:46 : it's funny that like this like these
• 28:48 : shapes are like similar but not exactly
• 28:51 : the same
• 28:52 : exactly with many things that you see in
• 28:55 : life like you're looking for the pattern
• 28:57 : and you're just want to generalize and
• 28:59 : you're like yeah it's just the same kind
• 29:01 : of thing i've seen that before
• 29:03 : and it is true that there's a lot of
• 29:06 : repeated patterns right
• 29:09 : every pattern every pattern is
• 29:12 : like has a variation
• 29:15 : on top of the last version of it that
• 29:18 : you see
• 29:19 : and there are infinite variations even
• 29:22 : though they look similar they're a
• 29:24 : little bit different from the next one
• 29:26 : in in this mandelbrot set which is just
• 29:29 : really crazy i i don't even know how it
• 29:32 : works like i can't really explain any of
• 29:35 : this stuff
• 29:37 : you saw the code that we wrote we didn't
• 29:39 : write that much code 88 lines of code
• 29:42 : yeah but like i feel like my mind can't
• 29:45 : like
• 29:46 : predict like how this will go in terms
• 29:49 : of like shaping yeah it's completely
• 29:51 : unpredictable yes like usually you think
• 29:54 : oh i'm gonna write an algorithm and it's
• 29:57 : gonna give me a
• 29:59 : regular
• 30:00 : shape like a circle or a star or
• 30:02 : something like that
• 30:04 : but no you just have no idea the
• 30:06 : mandelbrot set is one of the foundations
• 30:09 : of chaos theory and i'm not gonna do it
• 30:12 : justice i'm sure so summarize chaos
• 30:14 : theory what chaos theory is
• 30:17 : a very small number of rules can give
• 30:20 : rise to
• 30:22 : chaos that it's very very hard to
• 30:25 : predict like i haven't seen this pattern
• 30:27 : before actually this is today is the
• 30:30 : first time i it looks kind of like
• 30:32 : broccoli and it's like the meat of a
• 30:35 : tree