Space filling curves filling with water

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
(upbeat music) - A while back, I made a video about how water can solve mazes. And it got me thinking, that could be a really good way to show how space filling curves work. This is a Hilbert curve, which is a type of space filling curve, sort of. We'll get to the important pedantic reason that this isn't technically a space filling curve later in the video. This is also a space filling curve, and this is a 3D version of the Hilbert curve. The reason I wanted to create a space filling curve that can be filled with water is because I think watching it fill up helps to give an intuition for the fractal nature of a space filling curve. Plus, isn't it just really satisfying? I suppose I could just show an animation of it on screen, but where's the fun in that when you can visualize it with water, or with a marble run version, or even watch a 3D printer create one. So what is a space filling curve? Well, it's a curve in the mathematical sense, meaning it's a one dimensional line. It's infinitely thin. How is it that something infinitely thin can fill two dimensional space? Well, the answer is by being a fractal. You may have come across this fractal before. It's called the Koch snowflake. That can be generalized into these other fractal forms. And the more extreme you go with those angles, the more the fractal seems to fill two dimensional space. Like you can always zoom in and find the gaps, but there's a certain 2D-ness about it. It's like it's somewhere between one dimensional and two dimensional. And that's where the word fractal comes from, a mathematical object with, in some sense, a fractional dimension. So a space filling curve is a fractal that is a one dimensional line, but it has a fractal dimension of two because it can fill two dimensional space. It's a line that leaves no gaps. So how can this be a space filling curve? I can see gaps all over the place. Well, that's because this isn't a proper fractal. You may have heard that a fractal is something that is self similar. Looking back at the Koch snowflake, you can see that this segment is similar to the whole thing. And crucially, you can always zoom in and that will always be true. The Koch snowflake is knobbly all the way down. There are infinitely many knobbles. In reality, it's impossible to show infinitely many knobbles, and you can quote me on that. So what we have here is just the first three iterations of the true Hilbert curve. A true Hilbert curve would look like this, of course, because it's a space filling curve. That single infinitely long line reaches every point in this two dimensional square. Isn't that amazing? So how does a Hilbert curve work? Well, if I speed up the footage and you squint your eyes, you can see that the square gets filled up kinda like this. It goes whoop in a sort of upside down U shape. But if I slow the footage down and you unsquint your eyes a bit, you can see that each quarter of the square also gets filled up in that way. There's a yup, yup, yup, and a yup. And all those different U-shaped curves are joined together. And if you slow down to normal speed and you unsquint your eyes completely, you can see that each one of those quarters is split into a further four quarters, and they each do the same thing. You have to rotate these two Us so that they can all join up like this, and you have to rotate these two, let's call them higher order Us, as well to get to the next level. So while it's really instructive to see how one of these curves is constructed, I find it really helps with my intuition to watch the curve being filled at different speeds and different levels of squint. You get a real sense for the fractal-ness of it. You get a similar sense from watching one being 3D printed. This curve is actually a slight variation where the ends join up. You get a closed loop. The reason I 3D printed it was because I wanted to stretch it out. It's a bit like how this object with a fractal dimension of two can be stretched out into lower fractal dimensions. I can take this and pull on it, and it stops having a fractal dimension of two. I'm lowering its fractal dimension by pulling on it, and that's really fun. My first attempt to print it actually failed, and it failed because part of the print came unstuck from the print bed. And because it was unstuck, it was pushed around by the print nozzle whenever it came by, and that caused more and more of it to become unstuck. The unstuck-ness spread out into this region. That might seem like quite a mundane observation, but it relates to a really interesting property of the Hilbert curve, which is that the Hilbert curve has really good locality. It's a really fascinating subject, which I'm not going to go into because 3Blue1Brown did such a good job of it already. Link to that video in the description. Here's another type of space filling curve called a Gosper curve. And you can get a similar sense of it if you squint your eyes and speed it up. It fills this part, this part, this part, this part, this part, this part, this part. And if I slow it down and you don't squint so much, you can see that the same thing happens in each one of those individual parts. There was a slight issue with the integrity of this one. It started leaking when the water got halfway round, but I was able to push through and eventually fill the whole curve, but you can see there's some bubbles and stuff in there. But what about this? This is a Celtic labyrinth. You can see it carved in rocks and things around the UK. The way it's constructed is you start with this pattern, and you join the end points like this. It's really simple. But you can make it more complicated by adding more lines here at the beginning. Watching it fill up with water, you can see a kind of pattern to the way the circles fill up. But is it a fractal? I mean, if I increase the number of lines in the starting pattern more and more, in the limit, the path would fill space surely. So is it a space filling curve? Like I don't think it's a fractal. And does a curve need to be a fractal if it wants to be a space filling curve? I don't know. I need someone who's good at explaining maths. Who's good at explaining maths. Ooh, I know. Matt Parker. Yeah. Do you know anyone who's good at explaining maths? - The problem you have is proving rigorously that a curve fills space because we've only got a handful of mathematical ways we've managed to do that. And they work on specific ways of defining these curves, and I think your case is outside that. - Is that because my curve isn't, my curve. (laughs) Is that because the labyrinth isn't a fractal? - Yeah, so your problem is the Mould curve is not defined with like a recursive substitution approach. At the moment, the tools we use to prove a curve is space filling relies on this kind of iterative way of defining the function. - Yeah, 'cause if I zoom in on the labyrinth, you don't go, oh, it's a smaller version of the labyrinth. It's just, oh, it's a bunch of straight lines. Our current stage of mathematics means that we can't prove that every point is hit. - Mathematics, as always, is struggling to keep up with you, Steve. And so, it's gonna take a bit more iteration. We just haven't got, haven't got the mathematical equipment. - If you wanna see the whole conversation with Matt, I'll be posting that as a Patreon exclusive. I got another idea for a way to visualize the Hilbert curve from a video that AlphaPhoenix made in response to the video that I made about water solving mazes. Link in the description to that. He made the maze horizontal, which so many people asked me to do. I'm really glad that he did it. He also did it with electricity, and he showed how the height of the water changes through the maze and how that corresponds to the change in voltage through the electric circuit that he cut out in the shape of the maze. And then he plotted it all. And that made me think, wouldn't it be cool to have the Hilbert curve version of that plot, and then it could be like a marble run. And amazingly, when I searched for Hilbert curve marble run, the object already existed on Printables, so I printed it. It's cool, isn't it? So what about this cube? Well, this is the 3D version of the Hilbert curve. There are a number of ways to generalize the 2D Hilbert curve into three dimensions. This is the curve you get when you stipulate that you want the curve to be a closed loop. I started off with this drawing that I found by Henry Segerman, and I'm really grateful to Henry and his brother, Will Segerman, for helping me turn this drawing into this object where you can see actually the loop isn't closed. We've opened it here to create an in and out point. Just like my 2D Hilbert curve, the 3D Hilbert curve is incredibly stretchy. Check out Henry's video on that. Also his number file video, or you can just get one on Shapeways. Links to all of those things in the description. I am linking to a lot of things in the description in this video. But anyway, this was printed with a resin printer, and then the surface was polished. But you'll notice it's still cloudy. In my video called Why White Things Are White, I explain why that is and the solution. By wetting the surface of this cube with a liquid that has a similar refractive index to the resin, I can remove most of that cloudiness. Here it is filling up. And again, you can see the fractal behavior if you squint your eyes. It's not super easy to see into the middle, so here's a smaller cube that's just two levels. Of course, if this was a real fractal and it was knobbly all the way down forever, we'd have an infinite long line that goes to every single point in this three dimensional region. It would be one dimensional, but it would have a fractal dimension of three. How cool is that? The weirdest thing happened the other day. I was listening to a podcast episode, and halfway through, they started speaking French. I was like, this is so weird. And when I looked at the date that the podcast episode was published, I realized that that was the date when I myself was in France. So what happened was that particular podcast uses dynamically inserted ads. So when my device downloaded that episode when it became available, the podcast server could tell that I was in France and figured I should be served a French ad. I didn't realize it was an advert to begin with. I thought it was just a clever sketch and I was trying to decode it. Well, translate it, I suppose. But this sort of thing happens quite a lot. If you go to a foreign country, your device will typically try to serve you the foreign versions of things like websites, and it can be really annoying. One straightforward way to remove all that friction is to use a VPN, like the sponsor of this video, Surfshark. Surfshark VPN encrypts all the data leaving your devices. So it also prevents anyone else on the wifi network that you're on or at your internet service provider knowing the domains that you visit. And here in the UK, it's legal for ISPs to shape traffic based on type. So it can be really useful to hide the type of traffic from your internet service provider. But a VPN can also mask your location, meaning when you're abroad, you can switch your device to your home country and just go about your business, including watching streaming TV shows from back home that you wouldn't be able to watch otherwise. Though do check the terms and conditions of the particular streaming service. Whether you personally need a VPN is something only you can figure out for yourself. But if you think you might need a VPN, then the offer on this one is really good. If you go to surfshark.deals/stevemould and enter promo code STEVEMOULD at checkout, you'll get three months absolutely free. The link is also in the description. So regarder Surfshark aujourd'hui. I hope you enjoyed this video. If you did, don't forget to hit subscribe, and the algorithm thinks you'll enjoy this video next. (upbeat music)
Info
Channel: Steve Mould
Views: 3,836,361
Rating: undefined out of 5
Keywords:
Id: DWzXF9B68nQ
Channel Id: undefined
Length: 12min 7sec (727 seconds)
Published: Fri Jun 30 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.