Question: Problem 2 Write a Python function my_quadratic: The function takes 3 input: Hessian matrix Q, vector b, and vector x. (2pts) Test to see if

Problem 2 Write a Python function my_quadratic: The function takes 3 input: Hessian matrix Q, vector b, and vector x. (2pts) Test to see if the inputs have proper dimension. Print an error message if the dimensions of vectors are not correct. (2pts) Function returns 2 ouput: first is the quadratic function value evaluated at point x, second is the gradient of the function at point x. (6pts) Test to see if the quadratic is convex or not. Display a message if it is convex or not. You can use the a built-in function in Python that returns the eigenvalues of a matrix A. (5pts). Problem 2 Write a Python function my_quadratic: The function takes 3 input: Hessian matrix Q, vector b, and vector x. (2pts) Test to see if the inputs have proper dimension. Print an error message if the dimensions of vectors are not correct. (2pts) Function returns 2 ouput: first is the quadratic function value evaluated at point x, second is the gradient of the function at point x. (6pts) Test to see if the quadratic is convex or not. Display a message if it is convex or not. You can use the a built-in function in Python that returns the eigenvalues of a matrix A. (5pts)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
