Question
We first note how the polynomial in the previous exercise
can be written in the nested multiplication method:
8 + x(−10 + x(7 + x(−2 + x(3 + 12x)))).
Using this representation, the following pseudocode procedure
(implementing Horner’s method) can be used to evaluate the
given polynomial.
procedure PolynomialEvaluation2
(n: nonnegative integer;
r,a0,a1,a2,. . .,an: real)
begin
value := an
for j := n - 1 down to 0 do
value := aj + r * value
end
can be written in the nested multiplication method:
8 + x(−10 + x(7 + x(−2 + x(3 + 12x)))).
Using this representation, the following pseudocode procedure
(implementing Horner’s method) can be used to evaluate the
given polynomial.
procedure PolynomialEvaluation2
(n: nonnegative integer;
r,a0,a1,a2,. . .,an: real)
begin
value := an
for j := n - 1 down to 0 do
value := aj + r * value
end