# AMAT 415 — Matlab activity 6: Complex logarithms

If $x$ is a real number, then $\log(x)$ is an unambiguously defined real number if $x>0$. One reason for this is that $\log(x)$ is the inverse function of $e^x$, an increasing and therefore one-to-one function.

In the complex realm, $\log(z)$ is not well defined, echoing the fact the function $e^z$ is not one-to-one. (It’s periodic with period $2\pi i$ and thus $\infty$-to-one.)

To unambigiously define a complex logarithm, we must choose an interval $(\theta_0-\pi,\theta_0+\pi]$ in which to measure the angles of complex numbers: If $z\in\mathbb{C}$, then there is a unique $\theta\in (\theta_0-\pi,\theta_0+\pi]$ such that $z=|z|e^{i\theta}$. We can define a branch of logarithm subordinate to this choice by the rule $\log(z)=\log|z|+i\theta$. Although defined for all nonzero $z$, this branch of the logarithm is discontinuous along the ray $z=re^{i(\theta_0\pm\pi)}$, $r>0$.

A standard choice is $\theta_0=0$, putting $\theta$ in $(-\pi,\pi]$, and this is what MATLAB uses when computing logarithms using the command log. To “see” the discontinuity of this branch of the logarithm along $z=re^{i\pi}=-r$, $r>0$ — the negative real axis — try this:

>> h = 0.01;
>> x = -3:h:3;
>> A = ones(1,length(x))’*x;
>> B = A+i*A’;
>> C = log(B);
>> m = -min(min(imag(C)));
>> image(x,x,10*(imag(C)+m)); % We can’t plot a complex function of a complex variable!

How is does the discontinuity manifest itself on the picture? Is the discontinuity evident from the following plots? Why or why not?

>> image(x,x,10*(real(C)+m));
>> image(x,x,10*(abs(C)+m));

Since the logarithm function is discontinuous, functions defined in terms of it will also tend to be discontinuous. Let’s look at $f(z)=\log(e^z+1)$, for example.

>> x = -10:h:10;
>> A = ones(1,length(x))’*x;
>> B = A+i*A’;
>> C = log(exp(B)+1);
>> m = -min(min(imag(C)));
>> image(x,x,10*(imag(C)+m));

What do you conclude from this picture about the location of the discontinuities of $f(z)$? Try to confirm your claim theoretically. What if you replace imag by angle in the above snippet? What do you observe? Can you “explain” your observations?

Since the logarithm comes in many branches, so do functions that are defined using the logarithm, e.g., power functions: $g(z)=z^s$, $z\neq 0$, $s\in\mathbb{C}$. Here, $z^s$ is defined to be $e^{s\log(z)}$ where, implicitly, we have chosen a branch of $\log(z)$. (This choice of branch doesn’t matter when $s$ is an integer. Why?) Let’s consider the case $s=1/2$.

>> x = -3:h:3;
>> A = ones(1,length(x))’*x;
>> B = A+i*A’;
>> C = exp(1/2*log(B));
>> m = -min(min(imag(C)));
>> image(x,x,10*(imag(C)+m));

So $g(z)=z^{1/2}=\sqrt{z}$ is discontinuous along a ray. Thought question: Without mentioning logarithms, can you explain why a square root function cannot be continuous on the entire complex plane? You might want to consider how square roots behave on the unit circle.

Here another fun one:

>> C = log(1/2*(B.^2-1));
>> m = -min(min(angle(C)));
>> image(x,x,10*(imag(C)+m));

Can you explain the discontinuities?

FOR 2 BONUS POINTS ON ASSIGNMENT 3: There is a branch of the logarithm making $h(z)=\sqrt{z^2-1}$ continuous (and analytic) on $\mathbb{C}-\{x\in\mathbb{R}: |x|\geq 1\}$. Which one is it? Justify your answer.

This entry was posted in Uncategorized. Bookmark the permalink.

### One Response to AMAT 415 — Matlab activity 6: Complex logarithms

1. m88 says:

Hello, this weekend is nice designed for me, since this moment i
am reading this fantastic educational piece of writing here at my residence.