# Thread: Raising Complex Numbers to nth power.

1. ## Raising Complex Numbers to nth power.

Hello,

I'm currently working on a little project that will require me to iterate over complex numbers in order to work out if they belong in a set. To give a bit of background it's the Mandelbrot set using the function Z = Z^2 + C where C is the given co-ordinate represented as a Complex number.

For example:

Z = (1 +3i)^2
Therfore Z = (-8 + 6i)

The next iteration....

Z = (-8 + 6i)^2
Now Z = (28-96i)

I'm failing to see the step by step methodology for doing these raises to the power of 2. All the resources I've found provide generic functional references rather than broken down steps.

If anyone could shed some light on this I would be most appreciative.

Kind Regards,

Andrew

2. Originally Posted by andrew77077
Hello,

I'm currently working on a little project that will require me to iterate over complex numbers in order to work out if they belong in a set. To give a bit of background it's the Mandelbrot set using the function Z = Z^2 + C where C is the given co-ordinate represented as a Complex number.

For example:

Z = (1 +3i)^2
Therfore Z = (-8 + 6i)

The next iteration....

Z = (-8 + 6i)^2
Now Z = (28-96i)

I'm failing to see the step by step methodology for doing these raises to the power of 2. All the resources I've found provide generic functional references rather than broken down steps.

If anyone could shed some light on this I would be most appreciative.

Kind Regards,

Andrew
I think this is what you are asking for any complex number

$\displaystyle z=(a+bi)$

$\displaystyle z^2=(a+bi)(a+bi)=a^2+abi+abi+b^2i^2=(a^2-b^2)+2abi$

I hope this helps

3. Originally Posted by andrew77077
Hello,

I'm currently working on a little project that will require me to iterate over complex numbers in order to work out if they belong in a set. To give a bit of background it's the Mandelbrot set using the function Z = Z^2 + C where C is the given co-ordinate represented as a Complex number.
Andrew
Yeah, that's right. Get it straight first. Then get "Chaos and Fractals" by Peitgen et. at. Also, check out the Wolfram demonstrate site for it. Here's one:

Magnified Views of the Mandelbrot Set - Wolfram Demonstrations Project

4. Thanks for the pointers TheEmptySet and Shawsend!

I'll take those and mull them over. I'll be writing an algorithm to reproduce the set but rather than copy and paste one from the net I wanted to start from the ground up so that I have a concrete understanding of all this. I'm not particularly well versed with Maths but have a background in set theory and logic which is always useful...!

5. ## Another way to do it is....

To raze a complex number to n:th power.
Usually that is done by "de Movires" formula.
With it you can rase numbers to any power. Without any difficullty
The idea is to first write the number in polar form and then use the formula.
Hope it helps

6. ## As an example

For an example:

$\displaystyle Z = (1 +3i)$

To write $\displaystyle z^2 = (1+3i)^2$

$\displaystyle |z| = (1^2 + 3^2)^{0.5} = {\color{red}\sqrt{10}}$

and $\displaystyle \arg(z): \arctan(3) = 71.6^0$

then (1+3i) can be written as: $\displaystyle {\color{red}\sqrt{10}} (\cos(71.6)+i \sin(71.6))$

To raise this to the n:th power: $\displaystyle {\color{red}(\sqrt{10})}^n(\cos(71.6*n) + i \sin(71.6*n))$
Simple
hope it helps