## Thursday, October 11, 2012

### x^y > y^x Analysis ### Overview

Consider the following simple function:
if x^y > y^x then color1 else color2

It produces some very strange results when trying to graph it. Although the first quadrant looks like a fairly simple pattern defined by functions y = 1/(ax^2) and y = x, it's actually incredibly more complicated and shown in the conclusion. All other quadrants produce even stranger patterns due to having results in complex space.

Also the related function x^y - y^x has it's own set of interesting properties, pictured below.

### Pictures      ### Solution for Quadrants 1 and 4 curve ### Octave and Complex Numbers

Another weird thing is complex numbers in octave. Consider:
c1 = 1 + i
c2 = 1 - i
c3 = -1 + i
c4 = -1 - i

c1 > c3
ans = 1

c4 < c2
ans = 1

c1 > c2
ans = 0

c1 < c2
ans = 0

c1 == c2
ans = 0

c1 != c2
ans = 0

It looks like Octave is comparing only the real portions of complex numbers for less-than and greater-than, and then using both terms of testing equality. Vector normalization doesn't really work either since should we consider -1 - i equivalent to 1 + i? Although normalization actually makes more sense if you think of it in terms of polar coordinates, as opposed to the default octave handling.

### Source Code

https://github.com/plurSKI/curveCompare

### Conclusion

Mapping values into complex space always gives interesting results, although often difficult to interpret. This function is no different, but we can get a general idea how it behaves from some of the graphs. It seems to be defined via bisection of some strange function that looks like exponential decay in the 1st and 3rd quadrants. I have not yet fully explored quadrants 2 and 4 and will update this when I do. This symmetry is clearly visible when plotting the points of the difference in polar coordinates. Also note that anything but the first quadrant is somewhat debatable since it is doing comparisons in complex space, which is technically undefined.