Question: The conventional algorithm for evaluating a polynomial anxn + an1xn1 + +a1x + a0 at x = c can be expressed in pseudocode by

The conventional algorithm for evaluating a polynomial anxn + an−1xn−1 +· · ·+a1x + a0 at x = c can be expressed in pseudocode by
procedure polynomial(c, a0, a1, . . . , an: real numbers)
power := 1
y := a0
for i := 1 to n
power := power ∗ c
y := y + ai ∗ power
return y {y = ancn + an−1cn−1 +· · ·+ a1c + a0}
where the final value of y is the value of the polynomial at x = c.
a) Evaluate 3x2 + x + 1 at x = 2 by working through each step of the algorithm showing the values assigned at each assignment step.
b) Exactly how many multiplications and additions are used to evaluate a polynomial of degree n at x = c? (Do not count additions used to increment the loop variable.)

Step by Step Solution

3.54 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Here we have n 2 a 0 1 a 1 1 a 2 3 and c 2 Initially we set power equal to 1 ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

923-M-C-M-S (1561).docx

120 KBs Word File

Students Have Also Explored These Related Statistics Questions!