29
Algebraic Number and their Practical Applications Ron Wein January 2002

Algebraic Number and their Practical Applications Ron Wein January 2002

  • View
    218

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Algebraic Number and their Practical Applications Ron Wein January 2002

Algebraic Number and their Practical Applications

Ron Wein January 2002

Page 2: 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.

Page 3: Algebraic Number and their Practical Applications Ron Wein January 2002

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.

Page 4: Algebraic Number and their Practical Applications Ron Wein January 2002

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

Page 5: Algebraic Number and their Practical Applications Ron Wein January 2002

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

1000,1000,,

?2

2

cbxax

a

acbbx

cba

1?2 cbxax

Page 6: Algebraic Number and their Practical Applications Ron Wein January 2002

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

1000,1000,,

?24

2

cbxax

a

acbbx

cba

1?24 cbxax

Page 7: Algebraic Number and their Practical Applications Ron Wein January 2002

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

Page 8: Algebraic Number and their Practical Applications Ron Wein January 2002

Expression DAGs

a b c

42

-

-

x

a b c

+

+

a

acbbxcbxaxE

2

422

Page 9: Algebraic Number and their Practical Applications Ron Wein January 2002

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.

Page 10: Algebraic Number and their Practical Applications Ron Wein January 2002

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

Page 11: Algebraic Number and their Practical Applications Ron Wein January 2002

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

Page 12: Algebraic Number and their Practical Applications Ron Wein January 2002

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

Page 13: Algebraic Number and their Practical Applications Ron Wein January 2002

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.

Page 14: Algebraic Number and their Practical Applications Ron Wein January 2002

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.

Page 15: Algebraic Number and their Practical Applications Ron Wein January 2002

Existing Traits in CGAL

Line segments.

Poly-lines.

Circles.

Canonic parabolas.

Page 16: Algebraic Number and their Practical Applications Ron Wein January 2002

Our Goal

Providing a unified approach for handling arrangements for all these curve types (and more).

Page 17: Algebraic Number and their Practical Applications Ron Wein January 2002

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

Page 18: Algebraic Number and their Practical Applications Ron Wein January 2002

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).

Page 19: Algebraic Number and their Practical Applications Ron Wein January 2002

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).

Page 20: Algebraic Number and their Practical Applications Ron Wein January 2002

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:

Page 21: Algebraic Number and their Practical Applications Ron Wein January 2002

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

Page 22: Algebraic Number and their Practical Applications Ron Wein January 2002

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).

Page 23: Algebraic Number and their Practical Applications Ron Wein January 2002

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

Page 24: Algebraic Number and their Practical Applications Ron Wein January 2002

The Problem (2)

Cascaded computations may lead to very complicated expression trees, resulting in a high time consumption.

Page 25: Algebraic Number and their Practical Applications Ron Wein January 2002

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).

Page 26: Algebraic Number and their Practical Applications Ron Wein January 2002

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

Page 27: Algebraic Number and their Practical Applications Ron Wein January 2002

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.

Page 28: Algebraic Number and their Practical Applications Ron Wein January 2002

Disc Robot Motion Planning

Example of usage:

Motion planning for a disc robot in a room with polygonal obstacles.

Page 29: Algebraic Number and their Practical Applications Ron Wein January 2002

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/