procedure Horner(c, ao, a₁, a2, ..., an: real numbers) y := an for i:=1 to n y = y* c + an-i return y{y = anc" + an-1c" _n-1 + a₂c + ap} +

Linear Algebra: A Modern Introduction
4th Edition
ISBN:9781285463247
Author:David Poole
Publisher:David Poole
Chapter2: Systems Of Linear Equations
Section2.2: Direct Methods For Solving Linear Systems
Problem 2CEXP
icon
Related questions
Question

Discrete math

2. There is a more efficient algorithm (in terms of the number of multiplications and addi-
tions used) for evaluating polynomials than the conventional algorithm described in the previ-
ous exercise. It is called Horner's method. This pseudocode shows how to use this method to
find the value of anx" + an-1x" + ··· + a₁x + ao at x = c.
n-1
procedure Horner(c, ao, a₁, a2, ..., añ: real numbers)
y := an
for i:=1 to n
y := y* c + an-i
n-1
return y{y = anc" + an-1c² + ... + a₂c + ao}
a) Evaluate 3x² + x + 1 at x = 2 by working through each step of the algorithm showing
the values assigned at each assignment step.
Transcribed Image Text:2. There is a more efficient algorithm (in terms of the number of multiplications and addi- tions used) for evaluating polynomials than the conventional algorithm described in the previ- ous exercise. It is called Horner's method. This pseudocode shows how to use this method to find the value of anx" + an-1x" + ··· + a₁x + ao at x = c. n-1 procedure Horner(c, ao, a₁, a2, ..., añ: real numbers) y := an for i:=1 to n y := y* c + an-i n-1 return y{y = anc" + an-1c² + ... + a₂c + ao} a) Evaluate 3x² + x + 1 at x = 2 by working through each step of the algorithm showing the values assigned at each assignment step.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer