1 / 23

Administrative

Administrative. Oct. 2 Oct. 4 – QUIZ #2. (pages 45-79 of DPV). Polynomials. polynomial of degree d. p(x) = a 0 + a 1 x + ... + a d x d. Representing polynomial of degree d. the coefficient representation. (d+1 coefficients). evaluation. interpolation. the value representation.

swartwood
Download Presentation

Administrative

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Administrative Oct. 2 Oct. 4 – QUIZ #2 (pages 45-79 of DPV)

  2. Polynomials polynomial of degree d p(x) = a0 + a1 x + ... + ad xd

  3. Representing polynomial of degree d the coefficient representation (d+1 coefficients) evaluation interpolation the value representation (evaluation on d+1 points)

  4. Evaluation polynomial of degree d p(x) = a0 + a1 x + ... + ad xd

  5. Evaluation polynomial of degree d p(x) = a0 + a1 x + ... + ad xd (Horner’s rule) a0+x(a1+x(a2 + ... ))) R  0 for i from d to 0 do R  R*x + ai

  6. Interpolation a polynomial p of degree d such that p(a0) = 1 p(a1) = 0 .... p(ad) = 0 (x-a1)(x-a2)...(x-ad) (a0-a1)(a0-a2)...(a0-ad) p1 = (1/2) x2 – (1/2) x p2 = - x2 + 1 p3 = (1/2) x2 + (1/2) x

  7. Interpolation • compute p = (x-a0)...(x-ad) • compute • pi = p / (x-ai) for i=0,...,d • ri = pi / pi(ai) • 3) compute • q = c0 r0 + ... + cd rd Claim: q(ai) = ci for i=0,...,d

  8. Polynomials evaluation on 1 point O(d) evaluation on d points O(d2) interpolation O(d2)

  9. MAIN GOAL: Multiplying polynomials Polynomial of degree d p(x) = a0 + a1 x + ... + ad xd Polynomial of degree d’ q(x) = b0 + b1 x + ... + bd’ xd’ p(x)q(x) = (a0b0) + (a0b1 + a1b0) x + .... + (adbd’) xd+d’

  10. evaluate on >2d points p,q in evaluation representation p,q multiply in O(d) time interpolate pq in evaluation representation pq

  11. Evaluation on multiple points p(x) = 7 + x + 5x2 + 3x3 + 6x4 + 2x5 p(z) = 7 + z + 5z2 + 3z3 + 6z4 + 2z5 p(-z) = 7 – z + 5z2 – 3z3 + 6z4 – 2z5 p(x) = (7+5x2 + 6x4) + x(1+3x2 + 2x4) p( x) = pe(x2) + x po(x2) p(-x) = pe(x2) – x po(x2)

  12. Evaluation on multiple points p(x) = a0 + a1 x + a2 x2 + ... + ad xd p(x) = pe(x2) + x po(x2) p(-x) = pe(x2) – x po(x2) To evaluate p(x) on -x1,x1,-x2,x2,...,-xn,xn we only evaluate pe(x) and po(x) on x12,...,xn2

  13. Evaluation on multiple points To evaluate p(x) on -x1,x1,-x2,x2,...,-xn,xn we only evaluate pe(x) and po(x) on x12,...,xn2 To evaluate pe(x) on x12,...,xn2 we only evaluate pe(x) on ?

  14. n-th roots of unity 2ik/n = k e FACT 1: n = 1 k . l = k+l 0 + 1 + ... + n-1 = 0 FACT 2: FACT 3: FACT 4: k = -k+n/2

  15. FFT (a0,a1,...,an-1,) (s0,...,sn/2-1)= FFT(a0,a2,...,an-2,2) (z0,...,zn/2-1) = FFT(a1,a3,...,an-1,2) s0 + z0 s1 +  z1 s2 + 2 z2 .... s0 – z0 s1 -  z1 s2 - 2 z2 ....

  16. Evaluation of a polynomial viewed as vector mutiplication 1 x x2 . . xd (a0,a1,a2,...,ad)

  17. Evaluation of a polynomial on multiple points 1 xn xn2 . . xnd 1 x1 x12 . . x1d 1 x2 x22 . . x2d (a0,a1,a2,...,ad) . . . Vandermonde matrix

  18. Fourier transform 1 d-1 2(d-1) . . (d-1) 1 1 1 . . 1 1 1 2 . . d-1 (a0,a1,a2,...,ad) . . . 2 = e2 i / d FT - matrix

  19. Inverse fourier transform 1 d-1 2(d-1) . . (d-1) 1 1 1 . . 1 1 1-d 2(1-d) . . -(d-1) 1 1 2 . . d-1 1 -1 -2 . . 1-d 1 1 1 . . 1 . . . . . . 2 2 = e2 i / d

  20. Fourier transform – matrix view 1 1 0 D I Fn . . . 1 1 I -D Fn 0 . . . D=diag(1,,...,d-1) d=2n

  21. String matching string = x1,....,xn pattern = p1,...,pk k  (xi – pi)2 TEST = i=1 Occurs on position j ?

  22. String matching string = x1,....,xn pattern = p1,...,pk k  (xi – pi)2 TEST = i=1 Occurs on position j ? k  (xi+j-1 – pi)2 TESTj = i=1

  23. String matching with “don’t cares” Occurs on position j ? k  (xi+j-1 – pi)2 TESTj = i=1 pj = 0 DON’T CARE k  pj(xi+j-1 – pi)2 TESTj = i=1

More Related