polynomials. 2 content evaluation root finding root bracketing interpolation resultant

45
Polynomials

Upload: clifton-basil-shields

Post on 15-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

Polynomials

Page 2: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

2

Content

EvaluationRoot findingRoot BracketingInterpolationResultant

Page 3: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

3

IntroductionBest understood and most applied functions

Taylor’s expansion Basis of parametric curve/surface Data fitting

Basic Theorem: Weierstrass Approximation Theorem Fundamental Theorem of Algebra

Page 4: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

4

Evaluation – Horner’s Method

Compare number of multiplications and additions

01321)( axaaxaxaxaxp nnnn

Evaluate p(t)

p(t) = b0

Page 5: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

5

Details

3210

33

2210

)(

)(

taatatatp

xaxaxaaxp

100

211

322

33

)(

tbabtp

tbab

tbab

ab

Page 6: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

6

Details (cont)

)()(

)()()(

)(

)(

0

122

30

10212

323

3

012

23

3

tqtp

xqtxxqxp

xqtxb

btxxbtxxbtxb

tbbxtbbxtbbxb

axaxaxaxp

122

3)( bxbxbxq

100

211

322

33

)(

tbabtp

tbab

tbab

ab

Evaluate p(t) and p’(t)

p(t) = b0

p’(t) = c1

Page 7: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

7

Evaluating xk Efficiently

Instead of using pow(x,k), or any iterative/recursive subroutines, think again!The S-and-X method: S(square) X(multiply-by-x)See how it works in the next pagesUnderstand how to implement in program

Page 8: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

8

Say the exponent k in base-2: a2a1a0 (k>3)

7

12121

22

]][[

7111

x

x

xxx

SXSX

6

02121

22

]][[

6110

x

x

xx

SSX

5

12021

22

]][[

5101

x

x

xx

SXS

Except for the leading digit, replace 1 by [SX], 0 by [S]

Except for the leading digit, replace 1 by [SX], 0 by [S]

# of :

Each symbol, S or X, represents a multiplication

23

12121221

2222

]][][][[

2310111

x

x

xxxx

SXSXSXS

7 4 3 3

Page 9: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

9

ImplementationLeft-to-right scan

23

121212021

2222

]][][][[

2310111

x

x

xxxx

SXSXSXS

11101x2x4x16 x8 xz

Right-to-left scan

2321125222

120

1

1

1

0

1

Page 10: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

10

[Multiplication, division]

FFT…GCD of polynomials (Euler algorithm)

Page 11: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

11

Roots of Polynomials

Low order polynomials (for degree 4)

Quartics: see notes

Hi-precision formula for quadratics

Quadratics Cubics

Page 12: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

12

Calculator City (ref)

Page 13: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

13

Root Counting

P(x) has n complex roots, counting multiplicitiesIf ai’s are all real, then the complex roots occur in conjugate pairs.Descarte’s rules of sign Sturm’s sequenceBounds on roots[Deflation]

Page 14: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

14

Theorems for Polynomial Equations

Sturm theorem: The number of real roots of an

algebraic equation with real coefficients whose real roots are simple over an interval, the endpoints of which are not roots, is equal to the difference between the number of sign changes of the Sturm chains formed for the interval ends.

Page 15: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

15

Sturm Chain

Page 16: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

16

Example

38879.1 ,32836.10802951.0 ,334734.0 ,21465.1

13)( 5

ix

xxxf

Page 17: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

17

Sturm Theorem (cont)

For roots with multiplicity: The theorem does not apply, but … The new equation : f(x)/gcd(f(x),f’(x))

All roots are simple All roots are same as f(x)

Page 18: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

18

Sturm Chain by Maxima

Page 19: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

19

Maxima (cont)

Page 20: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

20

Descarte’s Sign RuleA method of determining the maximum number of positive and negative real roots of a polynomial. For positive roots, start with the sign of the coefficient of the lowest power. Count the number of sign changes n as you proceed from the lowest to the highest power (ignoring powers which do not appear). Then n is the maximum number of positive roots.

For negative roots, starting with a polynomial f(x), write a new polynomial f(-x) with the signs of all odd powers reversed, while leaving the signs of the even powers unchanged. Then proceed as before to count the number of sign changes n. Then n is the maximum number of

negative roots.

3 positive roots

4 negative roots

Page 21: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

21

Computing Roots Numerically

Newton is the main method for root findingCan be implemented efficiently using Horner’s methodQuadratic convergence except for multiple rootUse deflation to resolve root multiplicity; but can accumulate error; polynomials are sensitive to coefficient variationsNewton-Maehly’s method: roots converges quadratically even if previous roots are inaccurate

Page 22: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

22

Page 23: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

23

Experiment

P(x)=(x-1)(x-2)(x-3)(x2+1)Assume two imprecise roots have been found, 1.1 & 1.9The deflated (cubic) polynomial is then

x3-3x2+0.91x-3

Page 24: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

24

Maehly procedureFast convergence; accurate solution

Deflated cubicFaster convergence, but solution was plagued with the propagated error

Original quinticConverged to 3in many steps (5 was not a good guess for 3)

9.11

1.111 )()(

)(

kk xxkk

kkk xpxp

xpxx

Page 25: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

25

Polynomial Interpolation

Given (n+1) pairs of points (xi,f(xi)) find a nth-degree polynomial Pn(x) to pass through these pointsCompute the function value not listed in the table by evaluating the interpolating polynomial

Page 26: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

26

Lagrange Polynomial

High computational cost; cannot reuse pointsDivided difference: a better alternative

Page 27: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

27

Divided Difference

Page 28: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

28

Divided Difference (cont)

Page 29: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

29

Page 30: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

30

Resultant (of two polynomials)

An expression involving polynomial coefficients such that the vanishing of the expression is necessary and sufficient for these polynomials to have a common zero.

Page 31: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

31

Resultant (cont)

The equation Qz = 0 has nonzero solution IFF R=det(Q) vanishes.R is called the resultant of the equations.

with

The above system has common zero:

Page 32: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

32

Example

0

341

341

211

211

034

022

2

R

xx

xx

8

341

341

211

211

034

022

2

R

xx

xx

Page 33: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

33

Sylvester Matrix and Resultant

Page 34: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

34

Applications of Resultant

0)(

0)(

xq

xp

0),(

0),(

yxq

yxp

0)(

0)(

curve same for the 0),(

equation ingcorrespond Find

)(),()( :curve

ytq

xtp

yxF

implicit

tqtptcParamateri

R(x) = 0 IFF intersection exists

II. Algebraic curve intersection

I. Common zero

III. Implicitization

Page 35: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

35

Find Common Zero

The system has simultaneous zero iff the resultant is zero

Page 36: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

36

Result from Linear Algebra

has non-trivial solution if det(A) = 0

A reduced system (remove row n) gives the ratio:

Ai: remove column i

Page 37: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

37

Sylvester Resultant

To find the common zero, consider the reduced system

Page 38: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

38

Resultant in Maxima

x as independent variable

Byy

Byy

Ay

R

yxyB

Ayx

2

2

2

2

0

0

101

0

01

Page 39: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

39

Algebraic Curve Intersection

01),(

01),( 22

xyyxq

yxyxp

No real roots; no intersection (circle & hyperbola)

Page 40: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

40

Algebraic Curve Intersection

01),(

011),( 22

xyyxq

yxyxp

2 real roots; 2 intersection points

Page 41: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

41

Implicitization

The above system in t has a common zero whenever (x,y) is a point on the curve.

… a parabola

Application: parametric curve intersectionFind the corresponding parameter of (x,y) on the curve

Page 42: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

42

Parametric Curve Intersection

Cubic Bezier curve and its control points

Bernstein polynomial

implicitize f(x,y)=0 )(),()(:1 tytxtpc

)(),()(:2 sysxsqc

F(s)=f(x(s),y(s))=0

Find roots in [0,1]

Page 43: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

43

0012

210

0012

210

221

20

221

20

2

2

2

1

12

0

0

222

222

121

121

121)(

)()(

ytyytyyy

xtxxtxxx

tyttyty

txttxtx

ty

xtt

y

xt

y

x

ty

txtp

12

2)(:

1

2,

1

1,

1

0:)(

23

2)(:

1

2,

1

1,

0

0:)(

222

211

s

sscsc

tt

ttctc

29.0,69.0

04820

01242423

0443),(

2

22

21

s

ss

sss

yxxyxf

Quadratic Bezier Curve Intersection

Sketch using de Casteljau algorithm

[1, 2]

Page 44: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

44

De Casteljau Algorithm [ref]

A cubic Bezier curve with 4 control points

p(t), t[0,1] is defined.

Locate p(0.5)

Page 45: Polynomials. 2 Content Evaluation Root finding Root Bracketing Interpolation Resultant

45

Inversion

41

419

21

,,

yx

t

2

1

05

10

05

/

01

15

01

0

1015

150

015

:rowfourth theDiscarding

0

115

0115

15

0315

43

47

47

43

47

47

2

3

2

3

43

47

47

2

3

43

41

47

419

t

tt

t

t

t

t

t

t

Example

Given (x,y) on the curve, find the corresponding parameter t