## Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

## ← Intro 3.6 Box-Counting Dimension (2)

• 1 Follower
• 70 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=Y7R6EG6pg_U" data-team="complexity-explorer"></div> ``` 6 Languages

Showing Revision 3 created 11/11/2014 by Gayle Williams.

1. We can now experiment with box-counting dimension
2. using the NetLogo model called
3. boxcountingdimension.nlogo.
4. Here you can see that this allows us to
5. iterate examples of fractals just like we did
6. in the previous model.
7. So let's go for 4 iterations of this.
8. But we can do at this point now is
9. compare the Hausdorff dimension,
10. 1.262 that we calculated,
11. with a box-counting approximation.
12. So I'm going to do Box-Counting Setup here
13. and you can see there's an initial box length
14. set to 10, which you can change.
15. So here's the initial box right down here
16. and the increment is going to be 1.0.
17. So we're going to increase the box size
18. by 1 unit at each iteration.
19. Ok, so here this tells us
20. how many boxes there are and so on.
21. And watch over here as we do box counting
22. where the model is going to plot
23. the log of the number of boxes
24. versus the log of 1 over the box length
25. for each iteration. So let's just go ahead
26. and do that with Box-Counting Go.
27. Now this is just like we saw where we're
28. putting a grid of boxes over the figure.
29. You don't see the whole grid.
30. You're only seeing the boxes that contain pieces of the figure.
31. And at each time step, see iteration,
32. we see what the box length is
33. and the number of boxes that is being counted.
34. And here those values are being plotted.
35. And you see they're sort of beginning to
36. approximate a straight line.
37. So if we keep going, the boxes get bigger and bigger.
38. And then we can stop it by clicking again
39. on Box-Counting Go at any time.
40. I haven't actually run it for very long,
41. but I have some points and what I can do is
42. say Find Best Fit Line.
43. That does a linear regression
44. and computes a box-counting dimension here of 1.122,
45. which is a little bit different than the
46. Hausdorff dimension of 1.262.
47. Now that's because, remember
48. box-counting is just an approximation.
49. We can get a better approximation
50. if we start with a smaller initial box length,
51. or if we start with a smaller increment.
52. But that, of course, is going to take longer.
53. So let's start over with our Koch curve.
54. Iterate, iterate, iterate...ok.
55. And our approximation would also be improved
56. if we iterated more.
57. Box-counting Setup, and Go.
58. I can speed this up, but it's still kind of a slow calculation.
59. Net Logo is not known for its extreme speed of computing.
60. It's kind of a trade-off.
61. It's easy to program in, but not super fast.
62. But anyway, now you can run this, go away.
63. Go get a cup of coffee, like computer scientists like to do
64. while waiting for their program to finish.
65. And let it run for many iterations
66. and then see how well the
67. box-counting dimension approximates
68. the Hausdorff dimension.
69. And you'll see that the next exercise
70. is to test that out.