Math 2.0

Numerical analysis Recurrences and evaluation of functions Theorem

CORDIC

Builds on Trigonometric functionsArctangentRotation

Statement

Let n≥1n \ge 1, let ai=arctan⁡2−ia_i = \arctan 2^{-i} for i≥0i \ge 0 (see arctangent), and let Kn=∏i=0n−1(1+2−2i)−1/2K_n = \prod_{i=0}^{n-1} (1 + 2^{-2i})^{-1/2}. Let θ\theta be a real number with ∣θ∣≤∑i=0n−1ai\abs{\theta} \le \sum_{i=0}^{n-1} a_i. The CORDIC iteration in rotation mode starts from x0=Knx_0 = K_n, y0=0y_0 = 0, z0=θz_0 = \theta and, for i=0,…,n−1i = 0, \ldots, n-1, sets σi=1\sigma_i = 1 if zi≥0z_i \ge 0 and σi=−1\sigma_i = -1 otherwise, and xi+1=xi−σi2−iyi,yi+1=yi+σi2−ixi,zi+1=zi−σiai.x_{i+1} = x_i - \sigma_i 2^{-i} y_i, \qquad y_{i+1} = y_i + \sigma_i 2^{-i} x_i, \qquad z_{i+1} = z_i - \sigma_i a_i. Then, in exact arithmetic,

  1. xn=cos⁡(θ−zn)x_n = \cos(\theta - z_n) and yn=sin⁡(θ−zn)y_n = \sin(\theta - z_n);
  2. ∣zn∣≤an−1<2−(n−1)\abs{z_n} \le a_{n-1} < 2^{-(n-1)};
  3. hence ∣xn−cos⁡θ∣<2−(n−1)\abs{x_n - \cos\theta} < 2^{-(n-1)} and ∣yn−sin⁡θ∣<2−(n−1)\abs{y_n - \sin\theta} < 2^{-(n-1)}.

Remarks

Each step multiplies the vector (xi,yi)(x_i, y_i) by the matrix with rows (1,−σit)(1, -\sigma_i t) and (σit,1)(\sigma_i t, 1), t=2−it = 2^{-i}, which is 1+t2\sqrt{1 + t^2} times the rotation by the angle σiarctan⁡t\sigma_i \arctan t. After nn steps the scale factors multiply to 1/Kn1/K_n, which cancels x0=Knx_0 = K_n, and the total angle is ∑iσiai=θ−zn\sum_i \sigma_i a_i = \theta - z_n; this is clause 1. For clause 2, concavity of arctan⁡\arctan on [0,∞)[0, \infty) gives ai≤2ai+1a_i \le 2 a_{i+1}, hence ai≤ai+1+⋯+an−1+an−1a_i \le a_{i+1} + \cdots + a_{n-1} + a_{n-1} by induction. With this, the bound ∣zi∣≤ai+⋯+an−1+an−1\abs{z_i} \le a_i + \cdots + a_{n-1} + a_{n-1} passes from ziz_i to zi+1=zi−σiaiz_{i+1} = z_i - \sigma_i a_i, and at i=ni = n it gives ∣zn∣≤an−1\abs{z_n} \le a_{n-1}. Clause 3 follows because cos⁡\cos and sin⁡\sin are 11-Lipschitz. Since a0+a1+a2+a3≈1.618>π/2a_0 + a_1 + a_2 + a_3 \approx 1.618 > \pi/2, for n≥4n \ge 4 the method covers all θ∈[−π/2,π/2]\theta \in [-\pi/2, \pi/2]; other angles are first reduced by symmetries. Multiplication by 2−i2^{-i} is a shift in binary, so each step needs only shifts, additions and a table lookup of aia_i.

Going deeper

For a student

The same iteration in vectoring mode drives yy to 00 instead of zz, and then computes arctan⁡(y0/x0)\arctan(y_0/x_0) and, up to the known constant factor, the length x02+y02\sqrt{x_0^2 + y_0^2}. Replacing arctan⁡2−i\arctan 2^{-i} by artanh⁡2−i\operatorname{artanh} 2^{-i} and rotations by hyperbolic rotations gives the hyperbolic functions, the exponential and the logarithm; in that case some steps must be repeated to ensure convergence. The constant KnK_n tends to about 0.60730.6073 and is applied once at the start, not at each step.

Reading path

To understand this page from the ground up, read these 4 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Arctangent concept
  2. Rotation concept
  3. Trigonometric functions concept
  4. CORDIC statement

Further reading

  1. Web https://en.wikipedia.org/wiki/CORDIC
About this page
TagM4ZJ8QV3MR
URIm2://M4ZJ8QV3MR
Kindstatement, theorem
WritingW0 stub
MSC65Y04, 65D20
StatusThis copy of the site has no build data. Run m2 status M4ZJ8QV3MR.
AboutTrigonometric functions
UsesTrigonometric functions, Arctangent, Rotation
Same as

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)
  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.