Download presentation
Presentation is loading. Please wait.
1
Polynomials and the FFT(UNIT-3)
ADVANCED ALGORITHMS Polynomials and the FFT(UNIT-3)
2
Polynomials : A polynomial in the variable x over an algebraic field F represents a function A(x) as a formal sum : A(x) = aj xj j = 0 to n-1 Here, we call the values a0, a1, a2, a3,….,an-1 as the coefficients of the polynomial. A polynomial has degree k, if its highest non-zero coefficient is ak. Any integer strictly greater than the degree of a polynomial ‘k’, is degree-bound ‘n’. i.e., n > k.
3
The representation of a Polynomial :
Ex-1 : A(x) = 𝑥3 − 2𝑥 − 1 Here, A(x) has degree 3. A(x) has degree bounds 4,5,6,.. A(x) has coefficients (-1,-2,0,1) Ex-2 : 𝑥4 + 𝑥2 − 1 Here, A(x) has degree 4. A(x) has degree bounds 5,6,7,.. A(x) has coefficients (-1,0,1,0,1)
4
Coefficient Representation : (CR)
A CR of a polynomial of degree bound ‘n’ is a vector of coefficients a = Adding Polynomials : Let a = (a0,a1,a2,… , an-1) b = (b0,b1,b2,… , bn-1) Sum is the coefficient vector C, where c = (c0,c1,c2,… , cn-1) Here, cj = aj + bj j = 0,1,2,..,n-1.
5
Multiplying Polynomials :
Multiplying of two degree-bound ‘n’ polynomials A(x) and B(x) : C(x) = Ex-3 : Add & Multiply the following two polynomials : A(x) = x x + 9 B(x) = x x - 5 A(x) + B(x) = 2x x + 4 A(x) X B(x) = x4 – 6 x3 – 36 x x - 45
6
Horner’s Rule : Given the Polynomial :
p(x) = ai xi = a0 + a1 x + a2 x2 + … + an xn i = 0 to n Here, i = 0,1,2,..,n-1,n ai is a real number. The above polynomial can be written in the form : p(x) = a0 + x (a1 + x (a2 + x (a3 + …. + x (an-1 + an x )……)) Let x = x0 Now, assume bn := an bn-1 := an-1 + bn xo ………….. b0 := a0 + b1 xo
7
Here let us substitute b values into expression of p(x0).
So, p(x0) = a0 + x0 (a1 + x0 (a2 + x0 (a3 + …. + x0 (an-1 + bn x0 )……)) = a0 + x0 (a1 + x0 (a2 + x0 (a3 + …. + x0 bn-1 )……)) = ………… = a0 + x0 (a1 + x0 (a2 + x0 b3 )) = a0 + x0 (a1 + x0 b2) = a0 + x0 b1 = b0 Hence p(x0) = b0
8
Ex-4 : Evaluate 2x3 - 6x2 + 2x - 1 for x = 3
Synthetic Division : (Horner’s Method) x0 | x x x x0 3 | | i.e., The Value of p(x0) is 5.
9
Ex-5 : Evaluate x x x for x = 2 Synthetic Division : (Horner’s Method) x0 | x x x x0 2 | | i.e., The Value of p(x0) is 0.
10
3. Point-Value Representation :
A Point-Value Representation of a polynomial A(x) of degree-bound n is a set of n point-value pairs : {(x0 ,y0), (x1 ,y1), (x2 ,y2),…, (xn-1 ,yn-1),} such that all of the xk are distinct and yk = A(xk) for k = 0,1,2,…,n-1. Ex-6 : A(x) = x x + 1 Here, xk : 0, 1, 2, 3 A(xk ) : 1, 0, 5, 22 { (0,1), (1,0), (2,5), (3,22) }
11
Interpolation of PVR : The inverse of evaluation is Interpolation.
- determines coefficient form of polynomial from point value representation. Theorem : (Uniqueness of an interpolating polynomial) “For any set {(x0 ,y0), (x1 ,y1), (x2 ,y2),…, (xn-1 ,yn-1),} of n point-value pairs all the xk values are distinct, there is a unique polynomial A(x) of degree-bound n such that yk = A(xk) for k = 0, 1, 2, …, n-1.”
12
The above theorem can be written as :
The matrix on the left is denoted V(x0 , x1 , x2 , …, xn-1). It is known as : Vander-monde Matrix. i.e., a = V -1 y.
13
Z = j k (x – xj) / j k (xk – xj)
Lagrange’s Formula : A(x) = yk Z, where k = 0 to n-1 Z = j k (x – xj) / j k (xk – xj) Ex-7 : Consider the PVR : [ (0,1), (1,0), (2,5), (3,22) ] Here, 1.[(x-1)(x-2)(x-3)] / [(0-1) (0-2) (0-3)] = (x x x - 6) / - 6 = (-x x x + 6) / ….(1) And 0.[(x-0)(x-2)(x-3)] / [(1-0) (1-2) (1-3)] = ….(2)
14
And 5.[(x-0)(x-1)(x-3)] / [(2-0) (2-1) (2-3)]
= x x …Answer The above is the polynomial for the given PVR.
15
Adding Polynomials using PVR :
Let C(x) = A(x) + B(x) A : [(x0 ,y0), (x1 ,y1), (x2 ,y2),…, (xn-1 ,yn-1)] B : [(x0 ,z0), (x1 ,z1), (x2 ,z2),…, (xn-1 ,zn-1)] C : [ (x0 , y0+ z0), (x1 , y1+ z1), …., (xn-1 , yn-1+ zn-1) ] Ex-8 : Find the value of C(x) in PVR, where A(x) = x x + 1 B(x) = x3 + x2 + 1 Let x = (0,1,2,3) Then A : [(0,1), (1,0), (2, 5), (3,22) ] B : [ (0,1), (1,3), (2, 13), (3, 37) ] Hence C : [(0,2), (1, 3), (2, 18), (3, 59) ]
16
Multiplying Polynomials using PVR :
Let C(x) = A(x) . B(x) A : [(x0 ,y0), (x1 ,y1), (x2 ,y2),…, (x2n-1 ,y2n-1)] B : [(x0 ,z0), (x1 ,z1), (x2 ,z2),…, (x2n-1 ,z2n-1)] C : [ (x0 , y0 z0), (x1 , y1 z1),….,(x2n-1 , y2n-1+ z2n-1) ] Ex-9 : Find the value of C(x) in PVR, where A(x) = x x ; B(x) = x3 + x2 + 1 Let x = (-3,-2,-1,0,1,2,3) A : [(-3,20), (-2,-3), (-1,2),(0,1), (1,0), (2, 5), (3,22) ] B : [ (-3,-17),(-2,-3), (-1, 1),(0,1), (1,3), (2, 13), (3,17)] C : [(-3,340),(-2,9),(-1,2),(0,1), (1, 0), (2, 65), (3,814) ]
17
Ex-8 Contd… There are FOUR cordinates : C : [(0,2), (1, 3), (2, 18), (3, 59) ] Basing on First & Second Coordinates : - 2 x x x …..(1) 9 x x x …..(2) Basing on Third & Fourth Coordinates : - 54 x x x …..(1) 59 x x x …..(2) The denominator is 6. Finally 2 x3 + x x + 2
18
4. Complex Roots of Unity :
A complex nth root of unity (1) is a complex number such that n = 1. There are exactly n complex nth roots of unity : e2 i k / n for k = 0, 1, 2, …., n-1 where eiu = cos (u) + i sin (u) Using e2 i k / n = cos(2 k / n) + i sin(2 k / n) we can check that it is a root. (e2 i k / n)n = e2 i k = cos(2 k) + i sin (2k) = = 1
19
Principal nth Root of Unity : The Value n = e 2 ∏ i /n
Degrees : SIN 0 1/ 2 1 0 COS 1 1/ Principal nth Root of Unity : The Value n = e 2 ∏ i /n is called the ‘principal nth root of unity’. All of the other complex nth roots of unity are powers of n . The n complex nth roots of unity are : n0, n1, n2,….., nn-1 Note : Here, nn = n0 = 1
20
Ex-10 : Find the 8th complex roots of unity.
The two roots of unity are : +1, - 1 The complex 4th roots of unity are : 1, - 1, i, - i where (-1) = i In general, the n complex roots of unity are equally spaced around the circle of unit radius centered at the origin of the complex plane. Note : nj . nk = nj+k = n(j + k) mod n
21
Visualizing 8 Complex 8th Roots of Unity :
22
First Root : 80 = = 1 Here, k = 0, n = 8 So, 80 = e 2 ∏ i k / n = e 0 = 1 Second Root : Here, k = 1, n = 8 81 = e 2 ∏ i k / n = e 2 ∏ i / 8 = e ∏ i / 4 by using the formula eiu = cos (u) + i sin (u) So, 81 = cos (/4) + i sin (/4) = 1 / i / 2
23
So, 82 = cos (/2) + i sin (/2) = i
Third Root : Here, k = 2, n = 8 82 = e 2 ∏ i k / n = e 2 ∏ i 2 / 8 = e ∏ i / 2 So, 82 = cos (/2) + i sin (/2) = i Fourth Root : Here, k = 3, n = 8 83 = e 2 ∏ i k / n = e 2 ∏ i 3 / 8 = e ∏ i 3 / 4 So, 83 = cos (3/4) + i sin (3/4) = cos ( - /4) + i sin ( - /4) = - cos /4 + i sin /4) [since cos ( - x) = - cos x, sin ( - x) = sin x] = / 2 + i /2
24
Fifth Root : Here, k = 4, n = 8 84 = e 2 ∏ i k / n = e 2 ∏ i 4 / 8 = e ∏ i So, 84 = cos () + i sin () = - 1 Sixth Root : Here, k = 5, n = 8 85 = e 2 ∏ i k / n = e 2 ∏ i 5 / 8 = e ∏ i 5 / 4 So, 85 = cos (5/4) + i sin (5/4) = cos ( + /4) + i sin ( + /4) = - cos /4 + i (- sin /4) [since cos ( + x) = - cos x, sin ( + x) = - sin x] = / i /2
25
Seventh Root : Here, k = 6, n = 8
86 = e 2 ∏ i k / n = e 2 ∏ i 6 / 8 = e 3∏ i / 2 So, 86 = cos ( + /2 ) + i sin ( + /2) = - cos (/2) + i (- sin (/2) ) = i ( - 1) = - i Eighth Root : Here, k = 7, n = 8 87 = e 2 ∏ i k / n = e 2 ∏ i 7 / 8 = e ∏ i 7 / 4 So, 87 = cos (7/4) + i sin (7/4) = cos ( + 3/4) + i sin ( + 3/4) = - cos 3/4 + i (- sin 3/4) [since cos ( + x) = - cos x, sin ( + x) = - sin x] = cos /4 + i (- sin /4) = / i /2
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.