Algebraic Number and their Practical Applications
Ron Wein January 2002
Algebraic NumbersA 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:
01)( axaxaxp dd
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 BoundsFor 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.
Tests with a Linear Eqation 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
0
1000,1000,
?
bax
a
bx
ba
1?bax
Tests with a Quadratic 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
0
2
4±
1000,1000,,
?2
2
cbxax
a
acbbx
cba
1?2 cbxax
Tests with a Quartic 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
0
2
4±
1000,1000,,
?24
2
cbxax
a
acbbx
cba
1?24 cbxax
LEDA vs. COREAll tests consist of 1000 equation (both libraries were 100% correct in all cases). Running times are given in seconds:
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
Expression DAGs
a b c
42
-
-
x
a b c
+
+
a
acbbxcbxaxE
2
422
Evaluating Expressions (LEDA)E - Expression u(E) l(E)
integer n |n| 1
E1E2 u(E1)l(E2)+u(E2)l(E1) l(E1)l(E2)
E1E2 u(E1)u(E2) l(E1)l(E2)
E1E2 u(E1)l(E2) l(E1)u(E2)
kE1ku(E1)
kl(E1)
kE1 and u(E1)l(E1)k[u(E1)l(E1)
k-1] l(E1)
kE1 and u(E1)<l(E1) u(E1)k[u(E1)
k-1l(E1)]
At each stage, ifE=U(E)/l(E), we keep an upper bound u(E) on U(E) and a lower bound l(E) on L(E).
E - Expression u’(E) l’(E)
integer n log2 n 0
E1E2 1+max[u’(E1)+l’(E2),u’(E2)+l’(E1)
]
l’(E1)+l’(E2)
E1E2 u’(E1)+u’(E2) l’(E1)+l’(E2)
E1E2 u’(E1)+l’(E2) l’(E1)+u’(E2)
kE1 u’(E1)/k l’(E1)/kkE1 and u(E1)l(E1) [u’(E1)+(k-1)l’(E1)]/k l’(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.
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:
1)(11)( )()()(val)()( EDED ElEuEEuEl
The old bound (LEDA):
1)(1
1)( 22
)()()(val)()(
EDED ElEuEEuEl
Separation Bound (Linear)
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
D(E’)=1
(l(E’)u(E’)D(E’)-1)-1=M -1
u(E’)l(E’)D(E’)-1=2M 2
Separation Bound (Quadratic)E u(E) l(E)
a, b, c M = max(|a|,|b|,|c|) 1
4ac 4M 2 1
b2 M 2 1
b2-4ac 5M 2 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.5M 2 4M 2
ax2 4M 3+10.5M 2 4M 2
bx 3.2M 2+2M 2M
ax2+bx 21M 4+29M 3 8M 3
E’=ax2+bx+c 29M 4+29M 330M 4 8M 3
D(E’)=2
(l(E’)u(E’)D(E’)-1)-1 = (8M 3 30M 4)-1 = (240M 7)-1
u(E’)l(E’)D(E’)-1=240M 7
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.
Existing Traits in CGAL
Line segments.
Poly-lines.
Circles.
Canonic parabolas.
Our Goal
Providing a unified approach for handling arrangements for all these curve types (and more).
Conic Curves
A conic curve is the set of points (x,y) satisfying the equation:
022 wvyuxtxysyrx
Ellipse
04 2 trs
Hyperbola
04 2 trs
Parabola
04 2 trs
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).
Representation of Conic Arcs
Given x0 solve the quadratic equation:
002
002 wuxrxyvtxsy
Vertical ray-shooting:
04 22 wuxrxsvtx
Find all xs for which the equation above have exactly one solution – i..e. its discriminant is 0:
Vertical tangency points:
Representation of Conic ArcsIntersection points:
Given two conic curves:0:
0:22
2
221
wyvxuxytysxrC
wvyuxtxysyrxC
Let us denote:
vsvsEtstsD
wswsCususBrsrsA
Applying this to C1 leads us to the quartic equation:
022
22
22
222
2222
32422
vCEsCwExvBECvDtEsBCwDEuE
xvAEBvDtEtCDsBsACwDuDErE
xAvDtEtBDsABuDrDExtADsArD
EDx
CBxAxy
2
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:
11
221
002
1
)()(
)()(
BxAqrxxxpxp
BxAqrxxxpxp
0
0
1
11
111
B
A
BqA
ABrA
q
r
q
r
The Problem (2)
Cascaded computations may lead to very complicated expression trees, resulting in a high time consumption.
The Solution (2)
We can define the following types of points:
Original end-points.
Vertical tangency points. (conic, index)
Intersection points. (conic #1, conic #2, index)
Vertical ray-shooting points. (point, conic)
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).
Experimental ResultsArrangement Naïve conic
traitsFiltered
conic traitsFiltered
and cachedUsing 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
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.
Handling segments and circles is much simpler, since all the algebra needed is solutions to linear and quadratic equations.
Disc Robot Motion Planning
Example of usage:
Motion planning for a disc robot in a room with polygonal obstacles.
References
1. A Seperation Bound for Real Algebraic Expressions,C. Burnikel, S. Funke, K. Mehlhorn, S. Schirra, S. Schmitt (2001).
2. A New Constrcutive Root-Bound for Algebraic Expressions,C. Li, C. Yap (2000).
3. The LEDA homepage: http:/www.mpi-sb.mpg.de/LEDA/leda.html
4. The CORE hompage: http:/www.cs.nyu.edu/exact/core/