1
$\begingroup$

Given real $\phi$ and $\epsilon$, is there an efficient (as in: better than brute force) algorithm to compute a set of four integers $\left\{N_R,D_R,N_I,D_I\right\}$ such that $$\left|\frac{N_R}{D_R} + \frac{N_I}{D_I}i\right| = 1$$ and $$\left|\angle \left(\frac{N_R}{D_R} + \frac{N_I}{D_I}i\right) - \phi\right| \leq \epsilon$$

In other words, is there an efficient way to find a Gaussian rational with unit magnitude and complex phase in the range $[\phi-\epsilon,\phi+\epsilon]$ for small-ish epsilon?

My hope is to produce integers with 6 or fewer digits over all $\phi$ for $\epsilon = \frac{\pi}{180}$, but I'll take what I can get.

The most obvious approach to solving the problem is to find integers of proper signs that satisfy $$\left(N_R D_I\right)^2 + \left(N_I D_R\right)^2 = \left(D_I D_R\right)^2$$ $$\tan\left( \phi-\epsilon\right) \leq \frac{N_I D_R}{N_R D_I} \leq \tan\left( \phi+\epsilon\right)$$ but I'm out of my discrete number theory depth beyond this.

Any assistance would be appreciated.

1 Answers 1

2

We can parametrise the unit circle (minus the point $-1$) with

$$\gamma\colon t \mapsto \frac{(1-t^2) + 2ti}{1+t^2},$$

and $\gamma(t)$ is a rational point on the unit circle if and only if $t\in \mathbb{Q}$. One computes

$$\gamma\bigl(\tan \frac{\varphi}{2}\bigr) = e^{i\varphi},$$

so an efficient method to approximate $\tan \frac{\phi}{2}$ with rationals yields an efficient method to approximate $e^{i\phi}$ with rational points on the unit circle.

If you can efficiently compute $\tan$, a simple continued fraction expansion of $\tan \frac{\phi}{2}$ usually quickly leads to an approximation between $\tan \frac{\phi-\epsilon}{2}$ and $\tan \frac{\phi+\epsilon}{2}$.

  • 0
    Ah. Excellent. Thank you.2017-01-16