I was trying to make a class for complex numbers (VB.NET) but then I stumbled upon a problem. How do I define the $mod$ operator for Complex numbers?

First I asked Wolfram Alpha. It didn't help much. (But at least it told me it was possible to define).

Then, I searched Google, which didn't help much either. The most I found was this. Didn't help to clarify.

So I want to ask if any of you know how I could extend the $mod$ operator to the Complex numbers. Any help would be appreciated.

(P.S. I saw this question but I didn't see how the accepted answer answered it. What I want is a general formula for complex numbers.)

  • $\begingroup$ Can it be defined? $\endgroup$ – user122283 May 6 '14 at 0:42
  • $\begingroup$ @SanathDevalapurkar I told Wolfram to calculate some modulus with complex numbers and it managed to return values. Here's an example: wolframalpha.com/input/?i=%282%2Bi%29+mod+%283-5i%29 $\endgroup$ – Anonymous Pi May 6 '14 at 0:45
  • 2
    $\begingroup$ Since $\mathbb{C}$ is not ordered (and since every element of $\mathbb{C}$ is either $0$ or a unit), I don't really know what this would look like. $\endgroup$ – user61527 May 6 '14 at 0:45
  • $\begingroup$ @T.Bongers Maybe like this? wolframalpha.com/input/?i=%28a%2Bbi%29+mod+3 $\endgroup$ – Anonymous Pi May 6 '14 at 0:47
  • $\begingroup$ If your're talking about Gaussian integers $\,m+ni,\,\ m,n\in\Bbb Z\,$ then they have a Euclidean division algorithm using the norm $\,m^2+n^2\,$ as a measure of size. If not, you need to say more for the question to make sense. $\endgroup$ – Bill Dubuque May 6 '14 at 1:52

I tried using some modulus formulas but they didn't give the same results as W|A. Then I tried using the "alternate representations". They didn't give the same results! I figured out it was a bug and managed to make this general formula: $$(a+bi)\bmod (c+di)=a+bi+(c+di)\lceil-\frac{a+bi}{c+di}\rceil$$ Hope this helps someone else!

P.S. $\lceil a+bi\rceil = \lceil a\rceil + \lceil b\rceil i$

  • $\begingroup$ How do you define the ceiling of a complex number? $\endgroup$ – Cameron Williams May 9 '14 at 3:04
  • $\begingroup$ @CameronWilliams Edited ;) $\endgroup$ – Anonymous Pi May 9 '14 at 18:18
  • $\begingroup$ That doesn't look like it jibes with the results of the euclidean division algorithm. For instance, it seems very likely that there are cases where your definition would give $|(a+bi)\bmod (c+di)| \gt |c+di|$, which is the essential property for modulus. $\endgroup$ – Steven Stadnicki May 9 '14 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.