Home /
Expert Answers /
Computer Science /
b-polynomial-evaluation-a-polynomial-can-be-represented-as-an-array-in-which-the-coefficient-of-t-pa857
(Solved):
b) Polynomial evaluation A polynomial can be represented as an array in which the coefficient of t ...
b) Polynomial evaluation A polynomial can be represented as an array in which the coefficient of the k'th power of the variable is stored in array entry \( \mathrm{A}[\mathrm{k}] \). For example, the array whose values are: Would represent the polynomial \[ f(x)=12.3+40.7 x-9.1 x^{2}+7.7 x^{3}+6.4 x^{4}+8.9 x^{6} . \] To evaluate this function at \( \mathrm{x}=5.4 \) we would "plug in" \( 5.4 \) for each occurrence of the variable \( \mathrm{x} \) and perform the indicated arithmetic. Write a Python function evaluate \( (A, x) \) that determines the value of \( \mathrm{f}(\mathrm{x}) \) for the polynomial that is represented by the corresponding array A of coefficients. For each term of the polynomial, this function should make a call to the power() function that you wrote in part \( 3 a \). c) Run your code to evaluate the polynomial \[ f(x)=12.3+40.7 x-9.1 x^{2}+7.7 x^{3}+6.4 x^{4}+8.9 x^{6} \] at \( x=5.4 \) d) Asymptotic analysis Determine the maximum number of multiplications that are needed for any polynomial of degree n (not just for this instance with a polynomial of degree 6). For your initial work, you can identify a sum of terms. For your final answer, give a simple expression for the sum (involving a power of \( \mathrm{n} \), not a summation \( \Sigma \) ). What is the Big-Oh class for this algorithm?