# Algorithm to find transform random pairs into polar coordinates

I have some pairs of real numbers $(\rho_1,\alpha_1),\dots (\rho_n, \alpha_n)$. I know that all my $\rho$'s are positive, but there is no constraints on my $\alpha$'s. I want to find a function $\phi$ such as $((\rho_1,\theta_1),\dots,(\rho_n,\theta_n)$ are some cartesian products, with $\theta_i = \phi(\rho_i,\alpha_i)$.

Is there a way to find such a $\phi$? Thanks!

-
What do you want the relation between $\alpha_i$ and $\theta_i$ to be? –  Zhen Lin Jun 19 '12 at 22:11
If whenever $(\rho_i,\alpha_i)=(\rho_j,\alpha_j)$, $\theta_i=\theta_j$, then yes, of course. But I don't think that's what you meant to ask. Could you explain more clearly what you want? –  tomasz Jun 19 '12 at 22:11
@ZhenLin there is no relation between $\alpha_i$ and $\rho_i$, they are just given. –  S4M Jun 19 '12 at 22:14
@tomasz Basically I want a bijective transformations that will make my pairs polar coordinates. –  S4M Jun 19 '12 at 22:16
@S4M: You haven't explained what your inputs are! –  Zhen Lin Jun 19 '12 at 22:18

If I understood this correctly, you want a bijection from $\mathbb{R^+}\times\mathbb{R^+}$ to $\mathbb{R^+}\times[0,2\pi)$. How about:
$$\phi(\rho_i, \alpha_i) = \left(\rho_i, 2\pi\tanh(\alpha_i)\right)$$
Here is a plot of $2\pi\tanh(x)$ on $[0,3]$:
Yes, this one will do the trick. And I can always tweak a bit the $tanh^{-1}$ function if I am not happy with it... Thanks! –  S4M Jun 19 '12 at 22:35
@S4M - Happy to help! Please note that it's $\tanh$ (without $^{-1}$). I made a mistake in a previous comment. –  Ayman Hourieh Jun 19 '12 at 22:40