Fundamentals of Fractals 1: Introduction to Complex Numbers

image
This series aims to teach you the basics of programming fractals. Let’s start with introducing Complex Numbers, which is a topic within algebra and the fundamental for everything that is related to fractals. In the next tutorial, we will move more towards the theory of fractals.

z=x+yi
All complex numbers are represented by the form x+yi, where x and y are real numbers (positive, negative or zero), and the symbol for the set of complex numbers is C. This can be represented in a two dimensional coordinate system, the complex plane (C):

image

Say we have the function z = x+yi. In this function, x is what we call the real (R) part of z, and y is called the imaginary(i) part of z. In other words, in our graph above, the x axis is the real axis, and the y axis is the imaginary axis. A real number 8 is a function of the complex plane where y = 0 and x = 8. The formula z = x + yi = 8 + 0*i = 8, z = 8 shows us this.

Let’s take a look at the complex plane between -4+3i to 4-3i, filling out every function on the grid.
image

The imaginary i
Let’s take a closer look at this imaginary i:
image

So what’s happening here? We take the square root of a negative number? But that’s not possible! Sure, but this is where the i comes in. Everyone knows that i isn’t real, so that’s why it’s imaginary. It brings a few handy things to us, one is that it makes it possible to take the square root of a negative number:
image

in other words, i2 = –1! But.. wait, can’t i be –1 and 1 then?
image

That’s correct, and that’s what gives us the benefits of being able to take the square root of negative number. But, it will also require you to keep this in mind when dealing with the imaginary number.

Let’s take an example. We all know that the square root of 25 is 5. Lets see what the square root of –25 is:

image

 

Addition/Subtraction of Complex numbers
It is very simple to add or subtract two complex numbers together. Say we got two complex numbers where one is z=-3+2i and another is w=4+3i, and we want to add these together (z+w):
image

image

As you can se, the result will be a parallelogram from origo.
image

 

Multiplication of Complex Numbers
Multiplying complex numbers is a bit more complex than addition/subtraction.
The general rule of multiplying complex numbers:
image

If yi*vi = 3i2, it’s result will be –3.
(x + yi)(u + vi) = (xu – yv) + (xv + yu)i

The product of (1+2i)(3+4i) is: (3 + 4i + 6i + 8i2) = (3 + 1oi –8) = (-5+10i)

If you want to multiply a complex number by a real number u, the general rule is:
image

Simply multiply both parts of the complex number by the real number.

The power of i
The last thing I want to cover is the power of i. As we know, our imaginary number got some strange behaviors, and this accounts the power of i as well:image

Let’s continue with the 8 first:
image

This is just a brief introduction to complex numbers, but enough to get you started with fractals.

Any feedback and sources of confusion/mistakes are very welcome, see you next time! Smilefjes

Advertisements
This entry was posted in DirectX11, Math, Tutorial and tagged . Bookmark the permalink.

One Response to Fundamentals of Fractals 1: Introduction to Complex Numbers

  1. Espen says:

    Thanks, very informing! (especially for those of us who didn’t take math in school and all of a sudden finds himself needing it for graphics programming..)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s