Problem 2. The following algorithm which is used to evaluate a polynomial anx" + an-1x" -1 ++ a₁x + ªo at x = c is expressed in pseudocode as follows: procedure polynomial evaluation (c, ao,, an: real numbers) y := an for i:=1 to n y := y*c+an-i return y {y = anx² + an−1x¹−¹ + · + a₁x + ao}. where the final value of y is the value of the polynomial at x = c. (a) Evaluate 12x4 + 3x³ − 5x² + 7x - 8 at x = -1 by working through each step of the algorithm showing the values assigned at each assignment step CLEARLY. Answers with missing iterations, indices, etc. will not be taken into account. (b) How many additions and multiplications take place in the evaluation of a polynomial of degree n? Briefly explain. (Do not include the additions needed to increment the loop variable i.) (c) One can represent polynomials using nested multiplications, that is successively taking à as a common factor in the remaining polynomials of decreasing degrees, for example 3x³ + 2x² + 5x + 4 = x(x(3x + 2) + 5) +4. Represent the given polynomial given in (a) using nested multiplications and briefly explain the con- nection between the presented algorithm and this representation.

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 3CEXP
icon
Related questions
Question
Problem 2.
The following algorithm which is used to evaluate a polynomial
Anx"
+ an-1x"–1
+...+ ajx+ ao
at x = c is expressed in pseudocode as follows:
procedure polynomial evaluation (c, ao, · , an : real numbers)
y := an
for i := 1 to n
y := y * c + ɑn-i
return y {y = anx" + an-1x"-1 +...+ a1x + ao}.
where the final value of y is the value of the polynomial at x = c.
(a) Evaluate 12x4 + 3x³ – 5a² + 7x – 8 at x = -1 by working through each step of the algorithm
showing the values assigned at each assignment step CLEARLY. Answers with missing iterations,
indices, etc. will not be taken into account.
(b) How many additions and multiplications take place in the evaluation of a polynomial of degree n?
Briefly explain. (Do not include the additions needed to increment the loop variable i.)
(c) One can represent polynomials using nested multiplications, that is successively taking x as a
common factor in the remaining polynomials of decreasing degrees, for example
3x3 + 2x? + 5x +4= x(x(3x + 2) + 5) +4.
Represent the given polynomial given in (a) using nested multiplications and briefly explain the con-
nection between the presented algorithm and this representation.
Transcribed Image Text:Problem 2. The following algorithm which is used to evaluate a polynomial Anx" + an-1x"–1 +...+ ajx+ ao at x = c is expressed in pseudocode as follows: procedure polynomial evaluation (c, ao, · , an : real numbers) y := an for i := 1 to n y := y * c + ɑn-i return y {y = anx" + an-1x"-1 +...+ a1x + ao}. where the final value of y is the value of the polynomial at x = c. (a) Evaluate 12x4 + 3x³ – 5a² + 7x – 8 at x = -1 by working through each step of the algorithm showing the values assigned at each assignment step CLEARLY. Answers with missing iterations, indices, etc. will not be taken into account. (b) How many additions and multiplications take place in the evaluation of a polynomial of degree n? Briefly explain. (Do not include the additions needed to increment the loop variable i.) (c) One can represent polynomials using nested multiplications, that is successively taking x as a common factor in the remaining polynomials of decreasing degrees, for example 3x3 + 2x? + 5x +4= x(x(3x + 2) + 5) +4. Represent the given polynomial given in (a) using nested multiplications and briefly explain the con- nection between the presented algorithm and this representation.
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Linear Algebra: A Modern Introduction
Linear Algebra: A Modern Introduction
Algebra
ISBN:
9781285463247
Author:
David Poole
Publisher:
Cengage Learning
Elements Of Modern Algebra
Elements Of Modern Algebra
Algebra
ISBN:
9781285463230
Author:
Gilbert, Linda, Jimmie
Publisher:
Cengage Learning,
Algebra & Trigonometry with Analytic Geometry
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage