Question: Two questions in PYTHON: 1. Use np.polymul and np.polyint to define the L2 inner product of u and v on the interval (-1, 1). Both

Two questions in PYTHON:

1. Use np.polymul and np.polyint to define the L2 inner product of u and v on the interval (-1, 1). Both u and v are polynomials expressed as arrays in the usual way.

2.Compute the norm of the polynomial p(x) induced by poly_inner_product().Two questions in PYTHON: 1. Use np.polymul and np.polyint to define the

def poly inner_product (u, v): Use np.polymul and np.polyint to define the 12 inner product of u and v on the interval (-1, 1) Both u and v are polynomials expressed as arrays in the usual way # YOUR CODE HERE raise NotImplementedError def print_inner_product (u, v): display(Math( "\langle {}, .format (polystring(u), {} angle = {}" polystring(v), poly_inner product(u, v)))) print-inner-product([1], [1, oj) print-inner-product([1, 0, ], [1]) assert np.isclose(poly-inner-product([3,0,-1], [11), ) assert np.isclose(poly_inner_product ([3,0,-1], [5,0,-3,0]), ) assert np.isclose(poly_inner_product ([1,0], [5,0,-3,0]), e) assert np.isclose(poly_inner_product ([3,2,1], [4,0,3,1]), 11.2) def poly norm(p) Compute the norm of the polynomial p(x) induced by poly inner_product() # YOUR CODE HERE raise NotImplementedError() assert np.isclose(poly_norm([1]), np.sqrt(2)) assert np.isclose(poly_norm([1,0]), np.sqrt (2/3)) assert np.isclose(poly.nom( [3, ,-1]), .sqrt(8/5)) print('Tests pass def poly inner_product (u, v): Use np.polymul and np.polyint to define the 12 inner product of u and v on the interval (-1, 1) Both u and v are polynomials expressed as arrays in the usual way # YOUR CODE HERE raise NotImplementedError def print_inner_product (u, v): display(Math( "\langle {}, .format (polystring(u), {} angle = {}" polystring(v), poly_inner product(u, v)))) print-inner-product([1], [1, oj) print-inner-product([1, 0, ], [1]) assert np.isclose(poly-inner-product([3,0,-1], [11), ) assert np.isclose(poly_inner_product ([3,0,-1], [5,0,-3,0]), ) assert np.isclose(poly_inner_product ([1,0], [5,0,-3,0]), e) assert np.isclose(poly_inner_product ([3,2,1], [4,0,3,1]), 11.2) def poly norm(p) Compute the norm of the polynomial p(x) induced by poly inner_product() # YOUR CODE HERE raise NotImplementedError() assert np.isclose(poly_norm([1]), np.sqrt(2)) assert np.isclose(poly_norm([1,0]), np.sqrt (2/3)) assert np.isclose(poly.nom( [3, ,-1]), .sqrt(8/5)) print('Tests pass

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!