*In this blog post, when I write , I mean the natural logarithm, or log base , i.e., .*

A discussion on a pull request got me thinking about this question: what are the solutions to the complex equation ? At the outset, they look like different expressions. But clearly there some solutions. For example, if , then obviously the two expressions will be the same. We probably should exclude , though note that even if is well-defined (probably if it is it is either 0 or complex ), it will be the same well-defined value. But for the remainder of this blog post, I’ll assume that and are nonzero.

Now, observe that if we apply to both sides of the equation, we get . Now, supposing that we can apply the famous logarithm exponent rule, we would get , which means that if additionally is one-to-one, we would have that the original expressions must be equal.

The second question, that of injectivity, is easier to answer than the first, so I’ll address it first. Note that the complex exponential is not one-to-one, because for example . But we still define the complex logarithm as the “inverse” of the complex exponential. What this really means is that the complex logarithm is strictly speaking not a function, because it is not well-defined. Recall that the definition of one-to-one means that implies , and that the definition of well-defined is that implies . It is clear to see here that being one-to-one is the same as being well-defined and visa-versa ( here is the same loose definition of an inverse as saying that the complex logarithm is the inverse of the complex exponential).

So note that the complex logarithm is not well-defined exactly because the complex exponential is not one-to-one. We of course fix this problem by making it well-defined, i.e., it normally is multivalued, but we pick a single value consistently (i.e., we pick a branch), so that it is well-defined. For the remainder of this blog post, I will assume the standard choice of branch cut for the complex logarithm, i.e., the branch cut is along the negative axis, and we choose the branch where, for , is real and .

My point here is that we automatically know that the complex logarithm is one-to-one because we know that the complex exponential is well-defined.

So our question boils down to, when does the identity hold? In SymPy, this identity is only applied by `expand_log()`

or `logcombine()`

when is real and is positive, so let us assume that we know that it holds under those conditions. Note that it also holds for some other values too. For example, by our definition . For our example, this means that , is a non-trivial solution (non-trivial meaning ). Actually, the way that the complex logarithm being the “inverse” of the complex exponential works is that for all (on the other hand in general), so that if , then and . In other words, is always a solution, for any (and similarly for all ). In terms of our question of when , this just says that this always true for , regardless of , which is obvious. We can also notice that this identity always holds for , regardless of . In terms of our original equation, this means that is a solution for all (and as before, for all ).

Note that and real corresponds to and real, respectively, (which are the same condition). So we have so far that the following are solutions to :

- , arbitrary
- , arbitrary
- , arbitrary
- , arbitrary

Now let’s look at some cases where . If and is a nonzero even integer, then so , whereas , which are different by our assumption that . If is an odd integer not equal to 1, then , so = $latex \log{\left (\left(- z\right)^{a} \right )} + i\pi$ *WordPress is refusing to render this. It should be* log((-z)^a) + iπ = , whereas again, which is not the same because . This means that if we let and , where , we get a non-solution (and the same if we swap and ).

This is as far as I got tonight. WordPress is arbitrarily not rendering that LaTeX for no good reason. That and the very ugly LaTeX images is pissing me off (why wordpress.com hasn't switched to MathJaX yet is beyond me). The next time I get some free time, I am going to seriously consider switching my blog to something hosted on GitHub, probably using the IPython notebook. I welcome any hints people can give me on that, especially concerning migrating pages from this blog.

Here is some work on finding the rest of the solutions: the general definition of is , where is chosen in . Therefore, if , we must have . I believe a description of all such complex and will give all solutions , (and , ) to . I need to verify that, though, and I also need to think about how to describe such and . I will (hopefully) continue this post later, either by editing this one or writing a new one (depending on how much more I come up with).

Any comments to this post are welcome. I know you can't preview comments, but if you want to use math, just write it as `$latex math$`

(like `$latex \log(x)$`

for ). If you mess something up, I’ll edit your comment and fix it.