Ads

Tuesday, May 31, 2011

Complex Numbers

Ok, so, in the last few days I've learnt a few amazing things, and mostly these things are because of one person in particular, a certain fractalmath on youtube, who posted some videos a few years ago to explain how fractals are generated. He started by first explaining a bit about complex numbers, since they are an essential part of the fractal generating process. Thus, that is where I will begin too.

Please bare with me... It's all worth it in the end. After reading the next few posts, you will understand where the Mandelbrot Set comes from, but the process starts here.

Ok, so let's begin. You all remember the number line right? With all negative numbers to the left, positive to the right, and zero right between them? Something like this:
And you know that upon this line, all existing numbers can be found, whether they be huge, or tiny. 0.0000038885838943 can be found here, as well as 9,909,994,774,847,864,468 ... They're all there. And remember the term Real Numbers. Well all these guys on this particualr lin e are called exactly that: Real numbers.
But remember the other line, the vertical one? On which all these same numbers are plotted, with the positives running eternally up, and the negatives eternally down? Well, these guys are given a different name. Imaginary numbers. They are just as real, actually, as Real numbers, but they needed to be called something else to differentiate them. So they're written like this : 2i  ... or ... -0.5i  ... Any number, with a little i next to it.
So what is a complex number? A complex number is a set of two corresponding numbers, one real and one imaginary, with a physical position on the complex plane (see below). Remember those points in high school?: (x,y) .. Well, same thing here, only we say (n,ni) ... For example, (1, 2i) is a complex number. (-3, 1.5i) too, or (-1,-1.75i). And how do we use these copmplex numbers in equations? In this format: (1 + 2i) | (-3 + 1.5i) | (-1 -1.75i) ...Look at these three points plotted here:
And the red points? The red points are simply more complex numbers plotted on the complex plane, and here's the thing: Just like real and imaginary numbers on their lines, there are an infinite amount of points on the complex plane. That's important to note for later.

Adding and Multiplying Complex Numbers

How is it done? Let me show you, using my first two complex numbers above:

(1 + 2i) + (-3 + 1.5i) = (-2 + 3.5i)
When adding, you simply add together each of the real numbers, and then each of the imaginary numbers. Easy.

(1 + 2i) x (-3 + 1.5i) = ?
Multiplying is a bit trickier. You start off as you would normally, but then multiplying two imaginary numbers... How? :
How indeed. Well, according to mathematicians, i x i = -1 ... This is a rule. I don't understand it as yet, and maybe I will never need to understand it for the sake of creating beautiful fractals, but there it is.
So... 2i x 1.5i = -3

Thus
(1 + 2i) x (-3 + 1.5i) = -3 + 1.5i + 6i -3
(1 + 2i) x (-3 + 1.5i) = (-6 +7.5i)

Multiplying complex numbers on the complex plane

Now, for the purpose of understanding how this is all leading to fractal generation, you need to know how to determine the point of the answer of multiplying two other points on the complex plane. Look at this diagram:
 So what did I do? I took two points, and drew lines from zero to each point. I then measured each line (2 and 3) and also measured the angle between each line and the x-axis ... And as is stated in the diagram, to find the answer to those two points multiplied with each other, you simple add the angles and multiply the line lengths. Pretty neat, right?

Hehe... I can hear you guys saying ... C'mooonnn, get to the good stuff already. Don't worry, it's coming. It's gonna start getting really interesting from here on out. Those points on the complex plane, when fed into the function f(z)=z² + c, are what determines the shapes the amazing fractals you know. But how? That's what I'll get into next.

To end this post, here's a video of the original fractalmath, from whom I learnt all the above. Watch it and see if he explains things a bit better than I did :)
video

2 comments:

  1. I haven't read ahead yet, so don't shoot me if you learned this later. The reason i*i=-1 is because the number "i" itself is what you get when you take the square root of -1 (ha, all those tricky math teachers told you it could not be done!). So, just like sqrt(2)*sqrt(2)=2, sqrt(-1)*sqrt(-1)=-1 or i*i=-1

    Now ya know

    ReplyDelete
  2. Why thank you :) ... Actually pretty simple right? Hehe. But as you'll see ahead, I've become a whole lot more interested in the art side of fractals than the maths behind them. Especially the 3D variety ;) Thanks for reading, I hope you enjoy the rest of it. Follow with your Google account if you like :) I have been really distracted with personal matters recently but will get back to blogging soon!

    ReplyDelete