Python Division Of Complex Numbers Without Using Built In Types and Operators
<p>I have to implement a class called <code>ComplexNumbers</code> which is representing a complex number and I'm <strong>not allowed</strong> to use the <strong>built in types</strong> for that.
I already have overwritten the operators (<code>__add__</code>, <code>__sub__</code>, <code>__mul__</code>, <code>__abs__</code>, <code>__str_</code> which allows to perform basic operations.
But now I'm stuck with overwriting the <code>__div__</code> operator.</p>

<p>Allowed to use:</p>

<p>I'm using <code>float</code> to represent the imaginary part of the number and <code>float</code> to represent the rel part.</p>

<p>What I have already tried:</p>

<ul>
<li>I looked up how to perform a division of complex numbers (handwritten)</li>
<li>I have done an example calculation</li>
<li>Thought about how to implement it programatically without any good result</li>
</ul>

<p>Explanation of how to divide complex numbers:</p>

<p><a href="http://www.mathwarehouse.com/algebra/complex-number/divide/how-to-divide-complex-numbers.php" rel="nofollow noreferrer">http://www.mathwarehouse.com/algebra/complex-number/divide/how-to-divide-complex-numbers.php</a></p>

<p>My implementation of multiply:</p>

<pre><code> def __mul__(self, other):
        real = (self.re * other.re - self.im * other.im)
        imag = (self.re * other.im + other.re * self.im)
        return ComplexNumber(real, imag)
</code></pre>