Article 5MXBZ Complex floor and a surprising pattern

Complex floor and a surprising pattern

by
John
from John D. Cook on (#5MXBZ)

The floor of a real number x, written x, is the largest integer less than or equal to x. So, for example, = 3 and - = -4.

The previous post applied the floor function to a complex number z. What does that mean? You can't just say it's the largest integer [1] less than z because the complex numbers aren't ordered; there's no natural way to say whether one complex number is less than or greater than another.

The post was using Mathematica code, and Mathematica defines the floor of a complex number by applying the function to the real and imaginary parts separately. That is, if x and y are real numbers, then

x + iy = x + i y.

That lets you take the floor of a complex number, but is it useful? I wondered how many identities that hold for floors of real numbers extend to complex numbers when the floor is defined as above, so I looked at the chapter in Concrete Mathematics that has a bunch of identities involving floors and ceilings to see which ones extend to complex numbers.

Any identity where the real an imaginary parts don't interact should extend trivially. For example, for real x and integer n,

x + n = x + n.

This extends to the case where x is complex and n is a (complex) integer [1]. Addition works on real and imaginary components separately, just like Mathematica's definition of floor.

But here's one that's much more interesting. For positive x,

x = x.

Taking square roots deeply intertwines the real and imaginary parts of a number [3]. Does the identity above hold for complex inputs?

I wrote some Python code to test this, and to my great surprise, the identity often holds. In my first experiment, it held something like 84% of the time for random inputs. I expected it would either rarely hold, or hold say half the time (e.g. in a half-plane).

My first thought was to plot 1,000 random points, green dots where the identity holds and red stars where it does not. This produced the following image.

complex_rg.png

About 16% of the points are red and the rest green. In this plot there's no apparent pattern to the red points.

Since I'm sampling uniformly throughout the square, there's no reason to plot both where the identity holds and where it doesn't. So for my next plot I just plotted where the identity fails.

complex_blue1.png

That's a little clearer. To make it clearer, I rerun the plot with 10,000 samples. (That's the total number of random samples tested, about 16% of which are plotted.)

complex_blue2.png

Then to improve the resolution even more, I increased the number of samples to 1,000,000.

complex_blue3.png

It might not be too hard to work out analytically the regions where the identity holds and doesn't hold. The blue regions above look sorta like parabolas, which makes sense because square roots are involved. And these parabola-like curves has ziggurat-like embellishments, which makes sense because floors are involved.

Update

Define

f(z) = z - z.

The graphs above plotted the set of zs for which f(z) 0. We can see more information by plotting f itself. The function only takes on five possible values: 0, 1, i, -1, and -i. I plotted these as white, orange, green, blue, and red.

complex_5color.png

Related posts

[1] You could extend the meaning of integer" to a complex number with integer real and imaginary parts, commonly known as a Gaussian integer.

[2] I suspect Mathematica's definition is not common. I don't know of any other source that even defines the floor of a complex number, much less defines it as Mathematica does.

[3] You may be wondering what's going on with the square root. Complex numbers have two square roots, so which one(s) are we using? I'm doing what Python does, taking the principle branch. That is, using the analytic continuation of square root that extends from the real axis to the complex plane with the negative real axis excluded.

The post Complex floor and a surprising pattern first appeared on John D. Cook.VJmAlQ7-B54
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/TheEndeavour?format=xml
Feed Title John D. Cook
Feed Link https://www.johndcook.com/blog
Reply 0 comments