Exercises 36—39 refer to the following algorithm to compute the value of a real polynomial.
Algorithm 11.3.3 Term-by-Term Polynomial Evaluation
[This algorithm computes the value of a polynomial by computing each term separately, starting with , and adding it to an accumulating sum.]Input: n [a nonnegative inreger],
[an array of real numbers], x [a real number]Algorithm Body:
for to n for to i next j next i
Output: polyval [a real number] 37. Trace Algorithm 11.3.3 for the input , and
Trace algorithm 11.3.3 for the input , and
Complete the first column, is given as
is given. is given as .
, this is given therefore
goes from to , therefore at the start
, is given. Therefore when , .
goes from to , at the start . Therefore .
Completing column 2, Then we substitute ,
, Thus we update the second column,
Completing column 3,
Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!Get Started