how to compute Z^n? assuming $Z$ is a complex number i.e $a + bi$. we have
$Z^2 = (a + bi)^2 = (a^2-b^2)+(2ab)i$
$Z^3 = (a+bi)^3 = (a^3-3ab^2) - (b^3-3a^2b)i$
but what would be the general formula for computing $Z^n$ where n is any real number?
I wanted to use this method but i dont know how the computation goes for complex number $i$. also I want to do this computation on a computer so i have to keep real and imaginary parts separated from each other.
I know that i can only approximate numbers when $n$ is not an integer. but thats ok.
Is this even possible?

If, when you say "I want to use this method", you mean that you really want to use the binomial expansion, rather than using polar form, then $(a+ ib)^n$ will be a sum of monomials of the form $\frac{a^(n-i)(ib)^i}{i!}$.  "i" has "period 4".  That is $i^1= i$, $i^2= -1$, $i^3= -1$, and $i^4= 1$ so that further powers are just repeats of that.  You can separate that into one real part which will have powers that are multiples of 4 another subtracted with powers that are two more than multiples of 4, an imaginary part of two parts, the first with powers that are 1 more than multiples of 4, the second, subtracted with powers that are three more than powers of 4 : $\left(a^n+ \frac{a^{n-4}b^4}{4!}+ \frac{a^{n-8}b^8}{8!}+ \cdot\cdot\cdot+\frac{a^{n-4k}b^{4k}}{4k!}+ \cdot\cdot\cdot\right)- \left(a^{n-2}b^2+ \frac{a^{n- 6}b^6}{6!}+ \frac{a^{n-10}b^{10}}{10!}+ \cdot\cdot\cdot+\frac{a^{n-4k- 2}b^{4k+2}}{(4k+2)!}+ \cdot\cdot\cdot\right)+ i\left(a^{n-1}+ \frac{a^{n-5}b^5}{5!}+ \frac{a^{n-9}b^9}{9!}+ \cdot\cdot\cdot+\frac{a^{n-4k-1}b^{4k+1}}{(4k+1)!}+ \cdot\cdot\cdot\right)- i\left(a^n+ \frac{a^{n-4}b^4}{4!}+ \frac{a^{n-8}b^8}{8!}+ \cdot\cdot\cdot+\frac{a^{n-4k-3}b^{4k+3}}{(4k+3)!}+ \cdot\cdot\cdot\right)$.
