Question: 6.45 LAB: Polynomials The general form for a polynomial function of order n is f(x) = * a; Ti s=0 where the a, a, a,

 6.45 LAB: Polynomials The general form for a polynomial function oforder n is f(x) = * a; Ti s=0 where the a,

6.45 LAB: Polynomials The general form for a polynomial function of order n is f(x) = * a; Ti s=0 where the a, a, a, ..., an, are constant coefficients. Define a function polynomial() whose first argument is a variable x and whose second argument is a list of indeterminant length. The function should interpret the list as an ordered array of polynomial coefficients, such that a list of length N refers to a polynomial of order N- 1. CONCEPT REVIEW Any function definition is permitted one positional argument identifier prepended with a * Inside the function, the identifier is intepreted as a list. When the function is called, the * must prepend the positional argument. Any such argument must come after all other positional arguments LAB ACTIVITY 6.45.1: LAB: Polynomials 0/3 my_polynomial.py Load default template... 1 ''Your code goes here ! 2 3 if _name__ == '__main__': a = [1,-1,1,-1] X = 0.5 f = polynomial(x, *a) print('Polynomial @ x = {:.3f} w/ coeff. {:}: {:.3f}'.format(x,','.join([str(i) for i in a]), f)) a.extend([-2,8,7]) f = polynomial(x, *a) 10 print('Polynomial @ x = {:.3f} w/ coeff. {:}: {:.3f}'.format(x,','.join([str(i) for i in a]), f)) 11 a = [5,1] 12 f = polynomial(x, *a) 13 print('Polynomial @ x = {:.3f} w/ coeff. {:5}: {:.3f}'.format(x,','.join([str(i) for i in a]), f))

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!