Ruby

The Math Behind Mandelbrot

The Math Behind Mandelbrot

by David Bock

In the presentation titled "The Math Behind Mandelbrot," David Bock explores the intricate relationship between mathematics and the concept of infinity through the lens of the Mandelbrot set. The talk begins with Bock sharing his experiences in education, highlighting his engagement with students through various programming initiatives and his dedication to fostering an understanding of computer science in young learners. The impetus for the discussion arises from a high school student's inquiry about the utility of the imaginary number 'i'.

Key Points Discussed:
- The Origin of the Talk: Bock describes his journey into education and volunteering as part of programs aimed at enhancing computer science education, which informs his approach to teaching complex mathematics.
- Imaginary Numbers and Their Applications: He elucidates the significance of 'i', explaining its practical applications in fields such as engineering, weather navigation, and ultimately leading to a discussion of the Mandelbrot set.
- Mandelbrot Set and Infinite Complexity: Through the Mandelbrot set, Bock illustrates how simple mathematical rules can yield infinite complexity, discussing concepts such as self-similarity and fractal geometry evident in nature.
- Mathematical Concepts Explained:
- Trending Towards Infinity: He describes how different numbers trend towards zero or infinity, emphasizing the mathematical implications of this concept.
- Complex Numbers: Bock introduces complex numbers and explains how they can be represented on a complex plane, which allows visualization of their properties and behaviors.
- Fractals and Real-World Applications: The discussion covers various applications of fractal mathematics, from computer graphics to environmental simulations, showcasing the relevance of these concepts in modern technology.
- Historical Perspective on Fractals: Bock references the contributions of Benoît Mandelbrot and Edward Lorenz to chaos theory, providing a context for understanding the wider implications of fractals in nature and science.
- Engagement in Learning: Bock highlights the excitement and curiosity generated among students when engaging with fractal mathematics, urging others to participate in similar educational initiatives.

In conclusion, Bock emphasizes the profound connection between mathematics and computer science, underscoring the ways these fields interrelate and how they can enhance our understanding of the complexities of the universe. The talk serves as both an educational resource and an encouragement for active participation in the teaching of mathematics and computer science.

Overall, the presentation effectively captures the beauty of mathematics and its relevance in understanding both theoretical and practical aspects of the world around us.

00:00:11.990 Thank you for coming to my talk. I know it's a tough choice, as there are a bunch of good sessions I would love to be seeing right now.
00:00:17.820 This is not just a talk about the Mandelbrot set and the math behind it. I would describe this as a kind of Discovery Channel version of this talk. There's not a lot of heavy math at all, but I also want to explain why this talk exists.
00:00:29.490 It starts about three years ago with my boys; these are my triplets. I volunteer at their elementary school quite a bit through a program called Watchdog Dads, which allows dads like me to encourage everyone.
00:00:42.780 The sequence I'm about to show illustrates how I've gotten involved in some education in my county, and I would love to inspire others. Through Watchdog Dads, I volunteered at school occasionally. About two years ago, I took a week off work and ran about 400 third, fourth, and fifth graders through the Hour of Code for Computer Science Education Week.
00:00:57.120 Let me tell you, that was a blast! It was so beneficial to me, not just to the kids. I got a great quote from a fifth-grade girl who said, "Oh, so computers aren't smart; they're just dumb really, really fast!" How awesome is that?
00:01:10.680 After I did the Hour of Code, the principals talked to me about volunteering at the high school level through a program called TEALS, a nationwide organization that pairs computer science professionals with math teachers who may not be educated in computer science. This initiative aims to help math teachers and students get up to speed over a year or two, to the point where the math teachers can take over.
00:01:43.460 In my county, we already have a pretty active computer science department in high school, and I am fortunate to work with a great teacher. One morning, I arrived an hour before classes began a couple of days a week to go over homework and allow students to ask questions.
00:02:02.250 One day, a student of mine came in and asked the math teacher from a previous class about another topic. The student asked, "What is 'i' good for anyway? Is it something useful?" You could see the teacher freeze, with that deer-in-the-headlights look, wondering what to do.
00:02:43.480 I jumped in to help. But another encouraging thing I want to mention is that last year, we had 20 of my high school students volunteer to return to their elementary schools to do the Hour of Code, influencing over 2,000 kids in my county.
00:03:02.500 This year, Computer Science Education Week is organizing an Hour of Code featuring Star Wars characters. The kids don’t need to know anything; all they need is a browser. It's a simple drag-and-drop coding game where they can control characters on graph paper. It's so much fun! I encourage all of you to get involved with a local school.
00:03:30.100 So when the student asked, "What is 'i' good for anyway?" the teacher said, "Um, it's used in some real-world engineering mathematics stuff." I jumped in and said, "Well, first of all, if you do anything with analog circuitry, you need to know about imaginary numbers.
00:03:41.620 This knowledge is essential for calculating waveforms and understanding how circuitry evolves over time. It's also used in real-time weather navigation to perform calculations based on Doppler radar—and of course, my favorite topic, the Mandelbrot set.
00:04:10.000 However, I told them we didn't have enough time to answer that right then, and the math teacher said, "Well, on Friday we have our computer science club meeting. Do you want to talk about it then?" It was Wednesday, and I thought, "Uh, okay, I'll throw something together." That's where this talk originated.
00:04:42.680 First, I want to show a few slides and discuss the concepts involved in the Mandelbrot set. The reason it's fascinating is that it is generated from a few simple rules, yet it produces infinite complexity. If you saw the video playing as you entered, you can keep zooming in infinitely.
00:05:17.539 There is never a bottom in the Mandelbrot set, just a top that we will discuss later. As we zoom in, we discover more and more rich detail. You see the same shapes reappearing in different configurations, like this shape at the top called the Mandelbrot Beetle.
00:05:50.219 The various parts of the diagram have names we'll go over as we continue zooming in to find these shapes repeatedly. You'll understand what we’re looking at shortly, but this leads us to the concept of self-similarity and the fractal geometry of nature.
00:06:06.690 For instance, look at a galaxy, which shares many characteristics with completely different phenomena, like hurricanes. They exhibit similar patterns but are influenced by different forces. The fractal geometry of nature explains the growth patterns of plants and how the shape of broccoli resembles the structure of human lungs.
00:06:58.050 There are three concepts I want to cover: trending from 0 to infinity, imaginary numbers, and mapping to a plane. Let's discuss trending first. If we take two times two, what's that? Okay, let's multiply it again. We keep doing this, and we trend towards infinity.
00:07:43.919 Now, consider multiplying one forever. It just stays at one. What happens if we take point five times point five over and over? That trends to zero. Does it ever get there? No, we just get smaller and smaller numbers. If we look at velocities, point nine trends towards one; point nine, and so forth, approaches 1.73.
00:08:36.655 What about point nine nine nine? That trend also heads to one but more slowly. If we take into account how many times the trend takes to cross a threshold, it slows down further. The notions of how different numbers trend toward zero or infinity at different velocities are interesting and important.
00:09:40.440 Now let’s talk about squaring numbers. Two times two equals four. We can write this in mathematical notation. For example, we can say three squared is nine, and negative three squared is also nine. That's intriguing.
00:10:16.240 Let's discuss square roots. We know that the square root of nine is three. What about the square root of negative nine? What can we multiply together to yield a negative number? There isn’t any real number that achieves this, since a negative times a negative equals a positive.
00:11:08.180 This is where things become nonsensical. Therefore, square roots only apply to the first half of the number line. We have a trick up our sleeve: we can rewrite the square root of negative nine as the square root of nine times the square root of negative one.
00:11:35.840 Since we know that the square root of nine is three, we can now express the square root of negative nine in terms of 'i', our imaginary number. Thus, the square root of negative nine equals three 'i'. This gives us a method to switch back and forth.
00:12:31.150 Here are the rules for working with 'i': if you can simplify something down to the negative one, you can just call it 'i'. If we encounter 'i squared', we can simply designate it as negative one. This is a mind-blowing aspect of math—upon hitting roadblocks, we create labels and start using them.
00:13:29.640 However, we can't just add real numbers to imaginary numbers because we lack a defined relationship. So, we invent a new concept called a complex number, which contains both a real part and an imaginary part. For instance, seven point three two plus three point oh four 'i' represents a complex number.
00:14:05.720 Let’s combine these two concepts. If we define the value as one point two plus six point three 'i', the question arises: does it trend towards zero or infinity? Instead of plotting this on a number line, we will place it on a complex plane.
00:14:47.500 Here, 1.2 is the real part, and 0.63 'i' is the imaginary part. It can be positioned infinitely across many points in this plane. We can determine the absolute value of a complex number, which reflects its distance from zero on this plane using the Pythagorean theorem.
00:15:57.090 Now, to ascertain whether a certain point trends towards zero or infinity, we perform complex operations repeatedly. We can define C0 as the point on this plane, then C1 as the square of that point, adding C0 back to it, and continue iterating.
00:16:46.750 If it trends towards zero, we color it black, indicating it's part of the Mandelbrot set. If it trends towards infinity, we color it using the velocity of how many iterations it takes for the absolute value to exceed two.
00:17:39.890 We can prove that if the absolute value exceeds two, it will accelerate toward infinity. Thus, measuring how long it takes to get there becomes integral to the mathematics. Ruby has a complex class, which makes these calculations straightforward. We can test iterations efficiently.
00:18:42.500 In summary, we take a complex value and analyze it across a defined range, producing depth to infinity. The code does exactly this, testing each point to determine its velocity by running through a series of calculations.
00:19:51.378 I have a project on GitHub where you can see practical applications of this. Currently, it's set to draw an 800x800 square, testing depths up to 128. We explore ranges across the complex plane, generating a stunning visual representation.
00:20:18.100 Adding complexity through the inclusion of imaginary numbers allows us to understand varied rates at which things trend toward infinity. For instance, observe the iterations taken by different points when calculating.
00:20:57.900 The blue circles on the diagram reflect points that take various iterations to trend towards infinity. Each iteration reveals more about the overall structure and complexity.
00:21:34.160 As we zoom in further on features like Seahorse Valley, the calculations take longer due to the increased density and complexity. It is a beautiful process that showcases the stunning nature of mathematics and computation.
00:22:13.200 Returning to the visuals provided, it's fascinating to consider how years later I could generate intricate Mandelbrot fractals much faster than before, highlighting how technology has advanced.
00:23:14.330 Fractal mathematics extends beyond simple visualizations. These concepts are utilized in numerous industries, such as computer graphics for realistic terrain generation, as demonstrated in video production.
00:24:10.510 Examples of fractal mathematics being used for environmental simulations and diverse applications reflect their transformative power. They have played a significant role in everything from video games to scientific simulations, making them invaluable.
00:25:02.790 Exploring the history of fractals, we find that Benoît Mandelbrot, recognized for his contributions, was not the initial discoverer of these concepts. Edward Lorenz, in the 1950s, discovered that minute variations in parameters could lead to vastly different results.
00:26:17.390 His inquiry into weather patterns led to the concept of chaos theory, encapsulated by the famous phrase that a butterfly's wings might cause a tornado months later on the other side of the world.
00:27:02.200 This notion directly relates to the Mandelbrot set, which illustrates how tiny changes can lead to infinite complexity. Exploring boundaries reveals continuous variations, producing vibrant patterns.
00:27:55.240 Just as weather patterns reveal chaotic behaviors governed by infinitesimal adjustments, the edges of the Mandelbrot set reflect similar complexity that arises from its simple definition.
00:28:50.580 The Mandelbrot set showcases an infinite perimeter while maintaining a finite area, highlighting unconventional properties in mathematics. This concept is also evident in geographic measurements where coastlines display fractal characteristics.
00:29:37.170 As demonstrated by Mandelbrot, measuring coastlines can yield longer results with increased resolution due to their fractal nature. This phenomenon illustrates how fractal mathematics and geometry permeate various aspects of our world.
00:30:25.110 For resources, I have included links to additional information, including an extensive blog, a great book called Chaos, and a documentary originally on Netflix explaining these concepts further.
00:31:38.850 In closing, I'm open to any questions. Let's watch a deep zoom video together, accompanied by a song from Jonathan Coulton.
00:32:15.350 If anyone has a question, feel free to ask. I look forward to continuing this discussion.
00:32:34.350 I've worked on optimizing performance while utilizing complex numbers for these calculations. Students have been highly engaged in the learning process, demonstrating their passion by entering coding competitions and pursuing complex projects beyond standard curriculum.
00:35:09.300 Overall, the intersection of mathematics with computer science is profound, unearthing complexities that reflect elsewhere in nature. Thank you all for being here today!