Question: In Python- c) Write a function defined as: def Horner(x, coeffs) : x: a float coeffs: a list containing the coefficients of a polynomial, in

 In Python- c) Write a function defined as: def Horner(x, coeffs)

In Python- c) Write a function defined as: def Horner(x, coeffs) : x: a float coeffs: a list containing the coefficients of a polynomial, in order from the coefficient of the lowest power to the coefficient of the highest power. return value: the value of the polynomial for the given value of x, computed using Horner's Rule. Horner's Rule example: P(x) = 20+ a1 * x + a2 * x2 + 23 * x3 + 24 * x4 can be computed using Horner's Rule as: P(x) = (((a4 * x + a3) * x + a2 ) * x + a1 )*x + ao def main() : # define the variables needed to test the required functions myvals = [1,5,2,3,5,5, 3,5,2,5,3,3,1,5) mymatrix = [[1, 3.7, -7, 4], [-8, 9, 2, -1.8], [-12, 7.9, 3.2, 13]] a = [3, 1, -2, -4] xvals = [1, 2, 4, 5, 7] yvals = [2, 4, -2, 4, 5] x1 = 1.3 x2 = 6.3 mysmall = 4.9 # for part c) poly = Horner (x1, a) print('c) Polynomial value for (x1= {: .2f}) = {: .1f}'.format (x1, poly))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!