(a) Write a brute force method and Horner’s algorithm to evaluate a polynomial expression
and compute their complexities
(b) Evaluate the following polynomial expression using Horner’s rule. Assume the value of x
is 3.
p(𝑥) = 10𝑥5 + 6x4 + 3𝑥3 − 6𝑥2 + 8𝑥 + 15
Show all the intermediate steps.
b)
f(x) = a0 + a1x + a2x2 + a3x3 + a4x4 + a5x5
Can be arranged as follows
at "x_o"
f(x0) = a0 + x0(a1 + x0(a2 + x0(a3 + x0(a4 + a5x0))))
So
At k= 5
b5= a5=10
At k=4
b4=a4+xob5= 6+3×10=36
At k=3
b3=a3+xob4=3+3×36=111
At k=2
b2=a2+xob3=-6+3×111=327
At k=1
b1=a1+xob2=8+3×327=989
At k=0
b0=a0+xob1=15+3×989=2982
Therefore
"f(3)=2982"
Comments
Leave a comment