Question: Conditioning and relative error python For this question assume all norms and condition numbers refer to the 2-norm You are given a 50 50 matrix

Conditioning and relative error

python

Conditioning and relative error python For this question assume all norms andcondition numbers refer to the 2-norm You are given a 50 50

For this question assume all norms and condition numbers refer to the 2-norm You are given a 50 50 matrix A. You are also given a true vector x (xt rue) and an approximate vector x (xhat) 1. Compute the error vector Xerr (between the true vector x and the approximate vector ) and store it in err_xhat. 2. Compute the relative error 3. Calculate the relative error in A with respect to Ax and store it in relerr_Axhat. 4. Compute the condition number of A and store it in cond_A (you may use numpy.linalg.cond) 5. Use the relative error of the approximate vector (rel_err_xhat) and the condition number of A Xerr (cond_A) to calculate an upper bound on the relative error of Ak and store this upper bound in the variable bound_rel_err_Axhat. The setup code gives the following variables: Description A matrix true solution approximate solution Name Type 2D numpy array 1D numpy array D numpy array xtrue xhat Your code snippet should define the following variables: Name err_xhat rel_err_xhat rel_err_Axhat cond A bound_rel_err_Axhat floating point number Type 1D numpy array floating point number floating point number floating point number Description error vector for relative error in x relative error in AR condition number of A upper bound on the relative error in AR user_code.py For this question assume all norms and condition numbers refer to the 2-norm You are given a 50 50 matrix A. You are also given a true vector x (xt rue) and an approximate vector x (xhat) 1. Compute the error vector Xerr (between the true vector x and the approximate vector ) and store it in err_xhat. 2. Compute the relative error 3. Calculate the relative error in A with respect to Ax and store it in relerr_Axhat. 4. Compute the condition number of A and store it in cond_A (you may use numpy.linalg.cond) 5. Use the relative error of the approximate vector (rel_err_xhat) and the condition number of A Xerr (cond_A) to calculate an upper bound on the relative error of Ak and store this upper bound in the variable bound_rel_err_Axhat. The setup code gives the following variables: Description A matrix true solution approximate solution Name Type 2D numpy array 1D numpy array D numpy array xtrue xhat Your code snippet should define the following variables: Name err_xhat rel_err_xhat rel_err_Axhat cond A bound_rel_err_Axhat floating point number Type 1D numpy array floating point number floating point number floating point number Description error vector for relative error in x relative error in AR condition number of A upper bound on the relative error in AR user_code.py

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!