[ back ]
Complex arithmetics

In this documnet i will use three different definitions of a complex number, that is :

algebraic form of complex number

$\displaystyle z = ( z_\Re, z_\Im) = a + \imath b \\
$

geometric representation of complex number

$\displaystyle \begin{array}{l}
z = \Vert z\Vert \cdot \left( \cos\theta + \imat...
...} \\
\theta = \arctan{\frac{z_\Im}{z_\Re}}=\arctan{\frac{b}{a}}\\
\end{array}$

Euler's exponential form of complex number

$\displaystyle \begin{array}{l}
e^{\imath\theta} = \cos\theta + \imath \sin\theta \\
z = \Vert z\Vert\cdot e^{i\theta}
\end{array}$

Appart of all elementary mathematical operations (that it addition, substraction, division, multiplication which are elementary) i will now show how calculate most of elementary functions (like trigonometric functions, logarithms etc.) with complex arguments. In this document i will use some well known mathematical realations, that is Euler's formulas

$\displaystyle \sin{\theta} = \frac{1}{2\imath}\left( e^{\imath \theta}-e^{-\imath \theta} \right) \\ $ (1)

$\displaystyle \cos{\theta} = \frac{1}{2}\left( e^{\imath \theta}+e^{-\imath \theta} \right)$ (2)

and their analogy for real

$\displaystyle \sinh{x} = \frac{1}{2\imath}\left( e^{x}-e^{-x} \right) \\ $ (3)

$\displaystyle \cosh{x} = \frac{1}{2}\left( e^{x}+e^{-x} \right)$ (4)

Now you can do some math transformation to get what we want...

first, complex exponential of complex number

$\displaystyle e^z = e^{a+\imath b} = e^a\cdot e^{\imath b} = e^a\cdot\left( \cos b +\imath \sin b \right)
$

complex natural logarithm of complex number

$\displaystyle \ln{z} = \ln{ \Vert z\Vert \cdot e^{\imath \theta} } = \ln{\Vert z\Vert}+\imath \theta
$

complex logarithm (any base) of complex number

$\displaystyle \log_n{z} = \frac{\ln z}{\ln n} = \frac{ \ln{\Vert z\Vert} }{ \ln...
...th\frac{ \theta }{ \ln n}= \ln_n{\Vert z\Vert} + \imath\frac{ \theta }{ \ln n}
$

using eq.1 and eq.2 for complex argument we can obtain

$\displaystyle \sin{\left(\imath \theta\right)} = \frac{1}{2\imath}\left( e^{\im...
...ac{1}{2\imath}\left( e^{-\theta}-e^{\theta} \right) = \imath \sinh{\theta} \\
$

and

$\displaystyle \cos{\left(\imath \theta \right)} = \frac{1}{2}\left( e^{\imath (...
...)} \right)
= \frac{1}{2}\left( e^{-\theta}+e^{\theta} \right) = \cosh{\theta}
$

and also

$\displaystyle \tan{\left(\imath \theta \right)} = \imath \tanh(\theta)
$

and by setting $ \theta \rightarrow -\theta$ in above equations, we get hyperbolical functions for complex arguments

$\displaystyle \begin{array}{l}
\sinh(\imath \theta) = \imath \sin(\theta) \\
\...
...) = \imath \tan(\theta) \\
\cosh(\imath \theta) = \cos(\theta) \\
\end{array}$

using trigonometrical realtions for sine and cosine we can get sine and cosine for complex arguments

$\displaystyle \begin{array}{rl}
\sin{z} = \sin{(a+\imath b)} = & \sin{(a)}\cos{...
...
\ & \ \\
=& \sin{(a)}\cosh{(b)} + \imath \cos{(a)}\sinh{(b)} \\
\end{array}$

and

$\displaystyle \begin{array}{rl}
\cos{z} = \cos{(a+\imath b)} = & \cos{(a)}\cos{...
...
\ & \ \\
=& \cos{(a)}\cosh{(b)} - \imath \sin{(a)}\sinh{(b)} \\
\end{array}$

and also tangent function

$\displaystyle \begin{array}{rl}
\tan{z} = &\tan{(a+\imath b)} = \frac{ \tan(a)+...
... \frac{\tan^2(a)\tanh(b) + \tanh(b)}{1 + \tan^2(a)\tanh^2(b) } =\\
\end{array}$

in next step we will get hyperbolic trigonometry functions, using some well known realations (similar to those used previously). hyperbolic sine

$\displaystyle \begin{array}{rl}
\sinh{z} = & \sinh{(a+\imath b)} = \sinh{(a)}\c...
... \\
\ & \ \\
= & \sinh{(a)}\cos{(b)} + \imath \cosh{(a)}\sin{(b)}
\end{array}$

further we get hyperbolic cosine

$\displaystyle \begin{array}{rl}
\cosh{z} = & \cosh{(a+\imath b)} = \cosh{(a)}\...
... \\
\ & \ \\
= & \cosh{(a)}\cos{(b)} + \imath \sinh{(a)}\sin{(b)}
\end{array}$

and also hyperbolic tangent

$\displaystyle \begin{array}{rl}
\tanh{z} = & \tanh{(a+\imath b)} = \frac{ \tanh...
...ath \frac{\tan(b)-\tan(b)\tanh^2(a)}{1 - \tanh^2(a)\tan^2(b) } =\\
\end{array}$

in next section we will show complex power functions. where are three different ways to evaluate power functions in complex plane, we get one way for complex number to the integer power (de Moivre relation), other for complex number to the real power and quite similar complex number to the complex number. complex number to integer power (de Moivre)

$\displaystyle z^n = \Vert z\Vert^n\left[ \cos\left(n\theta\right) + \imath \sin\left(n\theta\right) \right]
$

complex number to real power

$\displaystyle z^r = \exp{(r\cdot \ln z)}=\exp{(r\ln\Vert z\Vert + \imath r\theta)}=e^{r\ln\Vert z\Vert}[\cos{(r\theta)}+\imath \sin{(r\theta)}]
$

complex number to complex power

$\displaystyle \begin{array}{rl}
z^{z_1} = &z^{c+\imath d}=\exp{(z_1\cdot \ln z)...
...os(c\theta+d\ln\Vert z\Vert)+\imath \sin(c\theta+d\ln\Vert z\Vert)]
\end{array}$

The last case is when we want to calculate integer (or real) number to the complex power

$\displaystyle \begin{array}{rl}
n^z = & n^{a+\imath b} = \exp( z \ln n ) = \exp...
... = \\
= & n^a \left( \cos(b \ln n) + \imath \sin(b \ln n) \right )
\end{array}$

thats all for now...


2006 (c) by http://devblog.malczak.info