Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python Coding HELP ASAP Thank you Problem 6. Define a function back_substitution (U,y) which accepts as input a square upper triangular matrix U and a
Python Coding HELP ASAP Thank you
Problem 6. Define a function back_substitution (U,y) which accepts as input a square upper triangular matrix U and a vector y and returns a vector x which is the solution to Ux=y. For example, if the matrix is U=np.array([[2,-3.1,1],[0,1,3], [0,0,4]]), and the vector is y=np.array([1,-2.1,3]) then back_substitution (U,y) should return the vector array([-6.6175, -4.35 , 0.75 ]). Hint: The only difference between the algorithms for forward and back substitution is the order you solve for the variables in. You should be able to solve this problem by making some minor changes to your code in Problem 5. Problem 7. Define a function LU_solver(A,b) which accepts as input a square matrix A and a vector b and returns the solution x to Ax=b. We assume that the matrix A is invert- ible and that row operations do not produce zeros on the diagonal. Thus LU_solver may call the functions LU_decomposition, back_substitution, and forward_substitution. For example, if the matrix is A=np.array([[3,1,-2],[1.5,2,-5], [2,-4,1]]), and the vector is b=np. array([1.1,3,-2]) then LU_solver(A,b) should return the vector array([-0.07032967, 0.34395604, -0.48351648])Step 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