TITLE: How can one go around dividing by zero when simplifying?
QUESTION [5 upvotes]: I have the expression $$\frac{1}{2}i\log\left(1-e^{\frac{2i\pi{x}}{b}}\right)-\frac{1}{2}i\log\left(1-e^{-\frac{2i\pi{x}}{b}}\right)$$ and I want to simplify it without getting any division-by-zero errors.  Like when I convert this to $$\frac{1}{2}i\log\left(\frac{1-e^{\frac{2i\pi{x}}{b}}}{1-e^{-\frac{2i\pi{x}}{b}}}\right)$$ I get division by zero whenever $e^{\pm\frac{2i\pi{x}}{b}}=1$.  Although, I know both expressions give singularities when $e^{\pm\frac{2i\pi{x}}{b}}=1$, the first one cancels out the singularity and outputs zero.  Is there a mathematical way to simplify an expression such as this and go around the division-by-zero problem?  Perhaps we can say that the $\log(\frac{n}{0})=0$? However that wouldn't satisfy me because no computation applications accept that.

REPLY [3 votes]: For 
$$\frac{1}{2}i\log\left(\frac{1-e^{\frac{2i\pi{x}}{b}}}{1-e^{-\frac{2i\pi{x}}{b}}}\right)$$
then let $y = (\pi x)/b$ to obtain
\begin{align}
\ln\left( \frac{1 - e^{2i y}}{1- e^{-2i y}} \right) &= \ln\left( \frac{e^{i y} \, (e^{-i y} - e^{i y})}{e^{- i y} \, (e^{i y} - e^{-i y}) } \right) \\
&= \ln\left( - e^{2 i y} \right) = \ln\left( e^{i (\pi + 2y)}\right) \\
&= i \, (\pi + 2y) = i \, \pi \, \left( 1 + \frac{2 x}{b}\right).
\end{align}
Now,
$$\frac{i}{2} \, \ln\left( \frac{1 - e^{2i y}}{1- e^{-2i y}} \right) = - \frac{\pi}{2} \, \left(1 + \frac{2 x}{b}\right).$$
Since $1 = e^{\pm 2 \, n \, \pi \, i}$, $n \geq 0$, then $e^{\pm \frac{2 \pi \, i \, x}{b}} = 1 = e^{2 \, n \, \pi \, i}$ leads to $\frac{x}{b} = n$ and the expression for the logarithm becomes
$$\frac{i}{2} \, \ln\left( \frac{1 - e^{2i y}}{1- e^{-2i y}} \right) = - \frac{\pi}{2} \, \left(1 + \frac{2 x}{b}\right) = - \frac{\pi \, (1 + 2n)}{2}.$$