# Super Code from Digital Knife Monkey Productions

## Digital Knife Monkeys at Keyboards...Will Eventually Program Everything.

### Blog

#### Equation of the Week #8: Complex Exponentiation

 Posted by DarthWho on November 23, 2011 at 11:45 PM comments (1)

Sorry for the huge delay in getting this one up my bad.

anyway:

how fo we calculate a^b when both A and B are complex numbers?

well this is where the complex exponentiation formula comes into play (this is a long one so hold onto your hats!

well first we have the formula:

E+Fi=(A+Bi)^(C+Di)

how do we work that out you ask? well it just so happens that that formula is equal to:

E+Fi=(A^2+B^2)^(C/2)*e^(-D*ARG(A+Bi))*(COS(C*ARG(A+Bi)+D*ln(A^2+B^2)/2)+i*SIN(C*ARG(A+Bi)+D*ln(A^2+B^2)/2))

or to split it up into components

G=(A^2+B^2)^(C/2)*e^(-D*ARG(A+Bi))

E=G*COS(C*ARG(A+Bi)+D*ln(A^2+B^2)/2)

F=G*SIN(C*ARG(A+Bi)+D*ln(A^2+B^2)/2)

I will try to update more regularly in the future;

this sunday: Calculus and why programmers should have some basic understanding of the subject. this will kick off a new seried which will focus on educating self professed math dummies on the mysteries of basic calculus.

#### Equation of the Week #7: The Complex Argument

 Posted by DarthWho on May 22, 2011 at 12:00 AM comments (1)

the complex argument is a function which is comonly used in functions such as complex exponentiation; it is a function which takes a Complex number and returns a real number to put it into easy to understand terms:

ARG(X + i * Y) = ARCTAN(Y / X)

Or to put it in terms of qb64 code:

ARG(X + i * Y) = ATN(Y / X)

NEXT WEEK: COMPLEX EXPONENTIATION

#### Equation of the Week #6: an introduction to math with Complex Numbers

 Posted by DarthWho on May 15, 2011 at 12:00 AM comments (0)

Complex numbers are not as difficult as they may first appear to be; this numeric system which is traditionally written in the form of:

A + B * i

Is the second of the division maths to be discovered; this is because like the real numbers the complex numbers are capable of being divided: however the complex numbers could also be written as

(A, B)

which brings us to a rather interesting point where it comes to these complex numbers: they form a twodimensional plane similar to the X,Y plane which is commonly used in programming.

now onto the basic mathematic operations:

(A + B * i) + (C + D * i) = (A + C) + (B + D) * i

Subtration

(A + B * i) - (C + D * i) = (A - C) + (B - D) * i

Multiplication:

(A + B * i) * (C + D * i) = (A * C - B * D) + (A * D + B * C) * i

and Division:

(A + B * i)/(C + D * i) = ((A * C + B * D) + (B * C + A * D) * i)/(C ^ 2 + d ^ 2)

NEXT WEEK: the Complex Argument. (ARG(z))