Rational Points on the Unit Sphere: Approximation Complexity and Practical Constructions Improved Analysis[1] Daniel Bahrdt ∗ Martin P
Total Page:16
File Type:pdf, Size:1020Kb
Rational Points on the Unit Sphere: Approximation Complexity and Practical Constructions Improved Analysis[1] Daniel Bahrdt ∗ Martin P. Seybold∗ July 27, 2017 Abstract 1. Introduction Each non-zero point in Rd identifies a closest point x on d−1 the unit sphere S . We are interested in computing an Many mathematical sciences use trigonometric functions d d−1 "-approximation y 2 Q for x, that is exactly on S in symbolic coordinate transformations to simplify fun- and has low bit size. We revise lower bounds on rational damental equations of physics or mathematical systems. approximations and provide explicit, spherical instances. However, rational numbers are dominating in computer We prove that floating-point numbers can only pro- processing as they allow for simple storage as well as 2 vide trivial solutions to the sphere equation in R and fast exact and inexact arithmetics (e.g. GMP[12], IEEE 3 R . Moreover, we show how to construct a rational point Float, MPFR[11]). Therefore problems on spherical sur- 2 with denominators of at most 10(d − 1)=" for any given faces often require to scale a point vector, as in choosing 1 " 2 0; 8 , improving on a previous result. The method a point uniform at random[20], or to evaluate a trigono- further benefits from algorithms for simultaneous Dio- metric function for a rational angle argument, as in deal- phantine approximation. ing with Geo-referenced data. Our open-source implementation and experiments A classical theoretical barrier is Niven's theorem[21], demonstrate the practicality of our approach in the con- which states that the sole rational values of sine for ratio- text of massive data sets Geo-referenced by latitude and nal multiplies of π are 0; ±1=2 and ±1. The well known longitude values. Chebyshev polynomials have roots at these values, hence Keywords Diophantine approximation, Rational give rise to representations for these algebraic numbers. points, Unit sphere, Perturbation, Stable geometric However, arithmetics in a full algebraic number field constructions might well be too demanding for many applications. For products of sine and cosine, working with Euler's formula on the complex unit circle and Chebyshev polynomials would suffice though. This manifests in problems of exact geometrical com- putations, since standard methodology relies on Carte- sian input[18]. Spheres and ellipsoids are common ge- ometric objects and rational solutions to their defining arXiv:1707.08549v1 [cs.CG] 26 Jul 2017 quadratic polynomials are closely related to Diophantine equations of degree 2. The famous Pythagorean Triples are known to identify the rational points on the circle S1. Moreover, the unit sphere has a dense set of ratio- nal points and so do ellipsoids with rational half-axes through scaling. Spherical coordinates are convenient to reference such Cartesians with angle coordinates and geo-referenced data denotes points with rational angles. Figure 1: Spherical Delaunay triangulation (gray) con- Standard approximations of Cartesians do not necessar- strained to contain all line segments (black) of ily fulfill these equations, therefore subsequent algorith- streets in Ecuador and the intersection points mic results can suffer greatly. of constraints (red). This paper focuses on finding rational points exactly d−1 d P 2 on the unit sphere S = x 2 R : i xi = 1 with ∗Formale Methoden der Informatik, University of Stuttgart, Ger- bounded distance to the point x=kxk2 { its closest point many, fbahrdt, [email protected] on Sd−1. In this work, x 2 Rd can be given by any finite 1 means that allow to compute a rational approximation to 1.2. Contribution it with arbitrary target precision. Using rational Carte- The strong lower bound on rational approximations to sian approximations for spherical coordinates, as derived other rational values does not hold for Geo-referenced from MPFR, is just one example of such a black-box data considering Niven's theorem. We derive explicit model. Moreover, we are interested in calculating ratio- constants to Liouville's lower bound, for a concrete nal points on d with small denominators. S Geo-referenced point, that is within a factor 2 of the strong lower bound. Moreover, we prove that floating- point numbers cannot represent Cartesian coordinates of 1.1. Related Work points that are exactly on S1 or S2. We describe how the use of rotation symmetry and Studies on spherical Delaunay triangulations (SDT), us- approximations with fixed-point numbers suffice to im- ing great-circle segments on the sphere S2, provide com- prove on the main theorem of [28]. We derive rational mon ways to avoid and deal with the point-on-sphere points exactly on Sd−1 with denominators of at most problem in computational geometry. 2 1 10(d−1)=" for any " 2 0; 8 . Moreover, our method al- The fragile approaches [23, 14, 25] ignore that the in- lows for even smaller denominators based on algorithms put may not be on S2 and succeed if the results of all for simultaneous Diophantine approximations, though a predicate evaluations happen to be correct. Input point potentially weaker form of approximation would suffice. arrangements with close proximity or unfortunate loca- The controlled perturbations provided by our method tions bring these algorithms to crash, loop or produce allow exact geometric algorithms on Sd to rely on ra- erroneous output. The quasi-robust approaches [5,4] tional rather than algebraic numbers { E.g. enabling weaken the objective and calculate a Delaunay tessel- convex hull algorithms to efficiently obtain spherical De- lation in d-Simplexes. Lifting to a d + 1 convex hull launay triangulations on Sd and not just Delaunay tes- problem is achieved by augmenting a rational coordinate sellations. Moreover, the approach allows for inexact but from a quadratic form { The augmented point exactly "-stable geometric constructions { E.g. intersections of meets the (elliptic) paraboloid equation. However, the Great Circle segments. output only identifies a SDT if all input points are al- We demonstrate the quality and effectiveness of the ready on the sphere, otherwise the objectives are distinct. method on several, including one whole-world sized, Equally unclear is how to address spherical predicates point sets. We provide open-source implementations for and spherical constructions. The robust approaches [27] the method and its application in the case of spherical use the circle preserving stereographic projection from Delaunay triangulations with intersections of constraints. S2 to the plane. The perturbation to input, for which the output is correct, can be very large as the projec- tion does not preserve distances. Furthermore, achieving 2. Definitions and Tools additional predicates and constructions remains unclear. The 2nd Chebyshev polynomials U of degree n are in The stable approaches provide geometric predicates and n Z[X], given their recursive definition: constructions for points on S2 by explicitly storing an al- gebraic number, originating from scaling an ordinary ra- U0(x) = 1 U1(x) = 2x tional approximation to unit length[10]. Algebraic num- Un+1(x) = 2xUn(x) − Un−1(x) : ber arithmetics can be avoided for S2, but exact evalua- tion relies on specifically tailored predicates [8], leaving It is well known [26], that the n roots of Un are exactly the implementation of new constructions and predicates the values f cos (πk= (n + 1)) : k = 1; : : : ; n g. Hence open. the polynomials Un give rise to algebraic representations Kleinbock and Merrill provide methods to quantify the for cosine values of rational multiplies of π. This is par- density of rational points on Sd [16], that extend to other ticularly useful in conjunction with classic results on Dio- manifolds as well. Recently, Schmutz[28] provided an phantine approximations, that are known since 1844[19]: divide-&-conquer approach on the sphere equation, us- ing Diophantine approximation by continued fractions, Theorem 1 (Liouville's Lower Bound). For any alge- to derive points in Qd \ Sd−1 for a point on the unit braic α 2 R of degree n ≥ 2, there is a positive constant sphere Sd−1. The main theorem bounds the denomina- c(α) > 0 such that tors in "-approximations, under the k k norm, with p 1 p c(α) ( 32dlog de=")2dlog2 de. Based on this, rational approxi- α − ≥ 2 q qn mations in the orthogonal group O(n; R) and in the uni- tary matrix group U(n; ) are found. This is of particu- C for any p 2 Z and q 2 N. lar interest for sweep-line algorithms: [7] studies finding a rotation matrix with small rationals for a given rational Apart from this lower bound on rational approxima- rotation angle of an 2D arrangement. tions, there is another important folklore result on the 2 a p existence of simultaneous Diophantine approximations. Observation 1. For rational numbers b 6= q , we have Such approximations have surprisingly small errors, de- spite their rather small common denominator. a p aq − bp 1 − = ≥ b q bq bq Theorem 2 (Dirichlet's Upper Bound). Let N 2 N and α 2 d with 0 ≤ α ≤ 1. There are integers p 2 d; q 2 R i Z 2 with 1 ≤ q ≤ N and If q < b, we have a lower bound of 1=q for ratio- Z a nal approximations to b with denominators up to q. 1 3 α − pi ≤ p : Pythagorean triples (x; y; z) 2 N provide such ratio- i q d 1 2 2 q N nal points on S , since (x=z) + (y=z) = 1. We have a lower bound of 1=z2 for approximations with denomina- (See AppendixB for a proof.) For d = 1, the continued tors q < z. See Section 3.4 for rational points on Sd with fraction (equivalently the Euclidean) algorithm is famous the same denominator property.