Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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().
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 passStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started