300 likes | 312 Views
Algebraic Number and their Practical Applications. Ron Wein January 2002. Algebraic Numbers. A real number x is algebraic if for some d there exist d +1 integers a d ,…, a 0 such that x is a root of the polynomial:.
E N D
Algebraic Number and their Practical Applications Ron Wein January 2002
Algebraic Numbers A real number x is algebraic if for some d there exist d+1 integers ad,…,a0 such that x is a root of the polynomial: Two libraries support exact computations with algebraic numbers: LEDA – developed in Max Planck Institut, Saarbrücken, Gremany. CORE – developed in Courant Institute, New-York, USA.
Separation Bounds For any given expression E a separation bound is an easily computable function sep: R such that the value val(E) of any non-zero expression E is lower bounded by sep(E) (that is |val(E)| < sep(E)). Using the separation bound, we can compute an approximation app(E) such that the approximation error is guaranteed not to exceed : | app(E) - val(E) | < • If |app(E)| > then sign(val(E)) = sign(app(E). • Otherwise, since |app(E)| – then |val(E)| < 2 : If 2 sep(E) – the whole expression equals 0. Otherwise, repeat the process process with /2.
Checks Correct Wrong Time (sec.) double 100,000 89,864 10,136 less than 0.01 Double 100,000 100,000 0 0.03 leda_real 100,000 100,000 0 22.33 leda_real 100,000 100,000 0 0.21 Tests with a Linear Eqation
Checks Correct Wrong Time (sec.) double 100,000 45,108 54,892 0.02 Double 100,000 99,962 308 0.07 leda_real 100,000 100,000 0 60.6 leda_real 100,000 100,000 0 0.39 Tests with a Quadratic Eqation
Checks Correct Wrong Time (sec.) double 100,000 36,267 63,733 0.02 Double 100,000 99,710 290 0.09 leda_real 100,000 100,000 0 282.62 leda_real 100,000 100,000 0 0.52 Tests with a Quartic Eqation
Number Type Core’s EXPR Leda’s leda_real Query E = 0 (?) E = 1 (?) E = 0 (?) E = 1 (?) Linear Test 0.21 0.24 0.22 0.002 Quadratic Test 2.57 2.68 0.61 0.004 Quartic Test 25.85 27.14 2.83 0.005 LEDA vs. CORE All tests consist of 1000 equation (both libraries were 100% correct in all cases). Running times are given in seconds:
+ + - - x a b c 2 a b c 4 Expression DAGs
E - Expression E - Expression u(E) u’(E) l’(E) l(E) integer n log2 n 0 integer n |n| 1 E1E2 1+max[u’(E1)+l’(E2),u’(E2)+l’(E1)] l’(E1)+l’(E2) E1E2 u(E1)l(E2)+u(E2)l(E1) l(E1)l(E2) E1E2 u(E1)u(E2) l(E1)l(E2) At each stage, if E=U(E)/l(E), we keep an upper bound u(E) on U(E) and a lower bound l(E) on L(E). E1E2 u’(E1)+u’(E2) l’(E1)+l’(E2) E1E2 u(E1)l(E2) l(E1)u(E2) E1E2 u’(E1)+l’(E2) l’(E1)+u’(E2) kE1 ku(E1) kl(E1) kE1 u’(E1)/k l’(E1)/k kE1 and u(E1)l(E1) k[u(E1)l(E1)k-1] l(E1) kE1 and u(E1)l(E1) [u’(E1)+(k-1)l’(E1)]/k l’(E1) kE1 and u(E1)<l(E1) u(E1) k[u(E1)k-1l(E1)] kE1 and u(E1)<l(E1) u’(E1) [(k-1)u’(E1)+ l’(E1)]/k For practical purposes it is easier to keep u’(E) and l’(E) that estimate the exponents of the bound. Evaluating Expressions (LEDA)
The Separation Bound Let D(E) be the weight of the expression E, i.e. the product of the degrees of all radical nodes in the expression DAG. Then either val(E) = 0, or: The old bound (LEDA):
E u(E) l(E) a, b M = max(|a|,|b|) 1 x=-b/a u(a)l(b)=M u(b)l(a)=M ax u(a)u(x)=M 2 l(a)l(x)=M E’=ax+b u(ax)l(b)+l(ax)u(b)=2M 2 l(ax)l(b)=M Separation Bound (Linear) D(E’)=1 (l(E’)u(E’)D(E’)-1)-1=M -1 u(E’)l(E’)D(E’)-1=2M 2
E u(E) l(E) a, b, c M = max(|a|,|b|,|c|) 1 4ac 4M2 1 b2 M2 1 b2-4ac 5M2 1 b2-4ac u(b2-4ac)l(b2-4ac)=2.2M 1 b±b2-4ac 3.2M 1 x=(b±b2-4ac)/2a 3.2M 2M x2 10.5M2 4M2 ax2 4M3+10.5M2 4M2 bx 3.2M 2+2M 2M ax2+bx 21M4+29M3 8M3 E’=ax2+bx+c 29M4+29M330M4 8M3 Separation Bound (Quadratic) D(E’)=2 (l(E’)u(E’)D(E’)-1)-1 = (8M330M4)-1 = (240M7)-1 u(E’)l(E’)D(E’)-1=240M7
Planar Arrangements Given a collection C of curves in the plane, the arrangement of C is the subdivision of the plane into vertices, edges and faces induced by the curves in C.
Arrangements in CGAL CGAL separates the topological handling of arrangements from the geometry, supplying a uniform construction method for any type of planar curve. The users should supply a traits class that should handle the geometry of the curves.
Circles. • Canonic parabolas. Existing Traits in CGAL • Line segments. • Poly-lines.
Our Goal Providing a unified approach for handling arrangements for all these curve types (and more).
Ellipse Hyperbola Parabola Conic Curves A conic curve is the set of points (x,y) satisfying the equation:
Conic Arcs A conic arc is defined by: - its base conic, - its source, - its target. In case of an ellipse, we can define the full conic as the arcs (not specifying the source and the target).
Representation of Conic Arcs The point p = (x,y) is on the conic arc a = (C,s,t) in iff it satisfies the equation of C and spt is a left turn (or a right turn if the orientation of C is negative).
Vertical ray-shooting: Given x0 solve the quadratic equation: Vertical tangency points: Find all xs for which the equation above have exactly one solution – i..e. its discriminant is 0: Representation of Conic Arcs
Given two conic curves: Let us denote: Applying this to C1 leads us to the quartic equation: Representation of Conic Arcs Intersection points:
The Problem (1) In order to give an exact analytic solution to a quartic equation, one needs to use trigonometric functions. The number type we use, leda_real, does not support trigonometric functions. In the future leda_real will be extended to include the diamond operator, where diamond(p(x),d) means the dth root of the polynomial p(x).
The Solution (1) Use an approximation method to solve quartic equations. Bairstow’s method: Given a polynomial p(x) with real-valued coefficients, extract a quadratic factor (x2-rx-q) from it, using the following iterated process:
The Problem (2) Cascaded computations may lead to very complicated expression trees, resulting in a high time consumption.
Vertical tangency points. (conic, index) Intersection points. (conic #1, conic #2, index) Vertical ray-shooting points. (point, conic) The Solution (2) We can define the following types of points: Original end-points. When creating a new point, we can compute only an approximation for this point. If necessary, we can use the attached information to refine the approximation (or even use an exact computation).
Arrangement Naïve conic traits Filtered conic traits Filtered and cached Using epsilon-tweaking rot_ellipses_2 12.73 0.75 0.64 0.01 tng_circles_8 3.19 2.67 2.67 0.06 tng_ellipses_9 14.55 11.11 2.03 0.14 rose_14 7.44 4.12 2.19 0.17 mix_20 N/A 234.44 5.28 0.28 mix_50 56.01 29.24 15.50 0.91 Experimental Results
Handling segments and circles is much simpler, since all the algebra needed is solutions to linear and quadratic equations. The Segment/Circle Traits As an intermediate by product, we have released an implementation of a traits class for arrangement of segments and circular arcs, based on the conic traits class.
Disc Robot Motion Planning Example of usage: Motion planning for a disc robot in a room with polygonal obstacles.
References • A Seperation Bound for Real Algebraic Expressions,C. Burnikel, S. Funke, K. Mehlhorn, S. Schirra, S. Schmitt (2001). • A New Constrcutive Root-Bound for Algebraic Expressions,C. Li, C. Yap (2000). • The LEDA homepage: http:/www.mpi-sb.mpg.de/LEDA/leda.html • The CORE hompage: http:/www.cs.nyu.edu/exact/core/