1. Re: Mandelbrot Set Project - Math part

Some Complex Arithmetic

Complex number have two components. This makes the arithmetic different than
for real numbers. I guess it's pretty similar to arithmetic with 2d vectors.
As I sit to write this I realise that I don't know how to do complex
division - because I've never had to use it.

Carl White has written a library to handle complex math. It's called
Complex.e. I downloaded it from the Euphoria website. It knows how to do
complex division..

Addition and subtraction isn't too hard. You just sum the real parts to get
the real part of the answer, and sum the imaginary parts to get the
imaginary part of the answer.

ie (1, 2i) + (1, 2i) = (2, 4i)
or (2, 3i) + (3, 4i) = (5, 7i)

Multiiplication is harder, but not much. We all did it in algebra when we
were multiplying polynomials. You just multiply all the terms in the first
bracket by all the terms in the second bracket and add the products up.

ie (2, 3i) * (3, 4i) = (2*3 + 2*4i + 3i*3 + 3i*4i)
   = (6 + 8i + 9i +12i*i) = (6 +17i +12i*i)

The trick here is with the i*i in "12i*i). i = squareroot of -1 so i*i = -1.
That turns our answer around a bit so that
(6 + 17i +12i*i) = (6 + 17i +12*-1) = (6 -12 +17i)
= (-6, 17i) as the complex number answer.

Bye
Martin

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu