Finding the magnitude of a complex number During a physics problem, I reached an expression for a complex number that looks like this:
$$ \frac{e^{i\theta}\left(e^{iP\theta}-1\right)}{e^{i\theta}-1} $$ where P is some constant. I want to express this complex number in the form $z = |z|e^{i\alpha}$. After more than an hour of struggling to get it to that form and failing. What am I missing here? Does it involve a lot of nasty algebra?
 A: $$e^{iP\theta}-1 = e^{iP\theta/2}(e^{iP\theta/2}-e^{-iP\theta/2})$$
$$e^{i\theta}-1 = e^{i\theta/2}(e^{i\theta/2}-e^{-i\theta/2})$$
$$ \frac{e^{i\theta}\left(e^{iP\theta}-1\right)}{e^{i\theta}-1}=
 \frac{e^{i(P+1)\theta/2}(e^{iP\theta/2}-e^{-iP\theta/2})}{e^{i\theta/2}-e^{-i\theta/2}}=\frac{\sin P\theta/2}{\sin \theta/2}e^{i(P+1)\theta/2}$$
A: $x$ and $y$ say hello.
Alternative (definitely inferior but do-able) approach.
It is assumed that $\theta$ is a variable, that $P \in \mathbb{R}$,
that $[e^{(i\theta)} - 1] \neq 0$
and that
you want to express
both $|z|$ and $\alpha$ as a function of $\theta$.
Set $x_1 = \{[\cos(P\theta)] - 1]\}$ and set $y_1 = [\sin P\theta].$
Set $x_2 = [\cos \theta]$ and set $y_2 = [\sin \theta].$
Set $x_3 = \{[\cos(\theta)] - 1]\}$ and set $y_3 = [\sin \theta].$
Keep in mind that for complex non-zero $z$ and $w$, 
where $\overline{w}$ signifies the complex conjugate of $w$, you have that
$$ \frac{z}{w} = \frac{1}{|w|} \times [z \times \overline{w}].$$
Let $N$ denote the complex number $(x_1 + iy_1) \times (x_2 + iy_2)$.  
Let $D$ denote $(x_3 + iy_3)$.
Then, you want the complex number $z = u + iv$, where
$$ z = \frac{N}{D}.$$
Clearly, $u$ and $v$ will be functions of $\theta$.
It then becomes straightforward to compute $|z| = \sqrt{u^2 + v^2}$ and then
specify $\alpha$ within a modulus of $2\pi$ re
$\cos \alpha = \frac{u}{|z|}, ~~ \sin \alpha = \frac{v}{|z|}.$
It is true that $u$ and $v$ will end up being very convoluted expressions in
$\theta$ and that attempting to simplify the expression for $\alpha$ in
terms of $\theta$ will be a nightmare.
However, in terms of offering an algorithm, it is unclear how relevant these
points are.
