Download presentation

Presentation is loading. Please wait.

Published byNatasha Beddingfield Modified over 3 years ago

1
Polynomial Evaluation

2
Straightforward Evaluation P(x) = 3x 5 +2x 4 +7x 3 +8x 2 +2x+4P(x) = 3x 5 +2x 4 +7x 3 +8x 2 +2x+4 t1 = (3*x*x*x*x*x)t1 = (3*x*x*x*x*x) t2 = t1 + (2*x*x*x*x)t2 = t1 + (2*x*x*x*x) t3 = t2 + (7*x*x*x)t3 = t2 + (7*x*x*x) t4 = t3 + (8*x*x)t4 = t3 + (8*x*x) P = t4 +(2*x) + 4P = t4 +(2*x) + 4 15 Multiplications, 5 Additions15 Multiplications, 5 Additions

3
A Little Smarter P(x) = 3x 5 +2x 4 +7x 3 +8x 2 +2x+4P(x) = 3x 5 +2x 4 +7x 3 +8x 2 +2x+4 t1 := 4; xp := x;t1 := 4; xp := x; t2 := (2*xp) + t1; xp := xp * x;t2 := (2*xp) + t1; xp := xp * x; t3 := (8*xp) + t2; xp := xp * x;t3 := (8*xp) + t2; xp := xp * x; t4 := (7*xp) + t3; xp := xp * x;t4 := (7*xp) + t3; xp := xp * x; t5 := (2*xp) + t4; xp := xp * x;t5 := (2*xp) + t4; xp := xp * x; P := (3*xp) + t5;P := (3*xp) + t5; 9 Multiplications, 5 Additions9 Multiplications, 5 Additions

4
Horner’s Rule P(x) = 3x 5 +2x 4 +7x 3 +8x 2 +2x+4P(x) = 3x 5 +2x 4 +7x 3 +8x 2 +2x+4 t1 = (3*x) + 2t1 = (3*x) + 2 t2 = (t1*x) + 7t2 = (t1*x) + 7 t3 = (t2*x) + 8t3 = (t2*x) + 8 t4 = (t3*x) + 2t4 = (t3*x) + 2 P = (t4*x) + 4P = (t4*x) + 4 5 Multiplications, 5 Additions5 Multiplications, 5 Additions

5
Computing Powers xp := x; pwork := power; Res := 1; While pwork > 0 Do If pwork mod 2 = 1 then If pwork mod 2 = 1 then Res := Res * xp; Res := Res * xp; End If End If xp := xp * xp; xp := xp * xp; pwork := pwork / 2; /* integer division */ pwork := pwork / 2; /* integer division */ End While

6
For Power = 15 6 Multiplications by Squaring Algorithm6 Multiplications by Squaring Algorithm An Alternative Procedure:An Alternative Procedure: p = x * xp = x * x p = p * p *xp = p * p *x p = p * p * pp = p * p * p 5 Multiplications by Factorization5 Multiplications by Factorization

Similar presentations

OK

Rationals- Synthetic Division POLYNOMIAL DIVISION, FACTORS AND REMAINDERS Synthetic division is an alternative method to dividing rationals. The great.

Rationals- Synthetic Division POLYNOMIAL DIVISION, FACTORS AND REMAINDERS Synthetic division is an alternative method to dividing rationals. The great.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google

Ppt on different types of plants Ppt on endangered and extinct animals Ppt on accounts payable process Ppt on popular social networking sites Ppt on economic systems Ppt on motivational stories Topics for ppt on environmental pollution By appt only Download ppt on wildlife conservation in india Ppt on interest rate swaps