Question: Python - please show screenshot of working code. 4b) Write a linear solver that utilizes PLU factorization. The cell below has the code for solving
Python - please show screenshot of working code.

4b) Write a linear solver that utilizes PLU factorization. The cell below has the code for solving Ax = b using LU factorization for reference. You can use the triangular solver functions as is, but modify the general solver as necessary to use PLU instead of LU. Insert your code for your PLU solver in the cell below: In [ ]: def LU_solve(A,b): L,U = LU_factor(A) y = lower_tri_solve(L,b) X = upper_tri_solve(U,y) return x, y def PLU_solve(A,b): solve linear system Ax=b using PLU factorization (Gaussian elimination with pivoting) Args: A: 2D numpy array representing a matrix b: 1D numpy array of right-hand side values Returns: X: 1D numpy array corresponding to solution # Your Code Here In [ ]: b = np.array( [24,7,17]) x0 = np.array( [3,-2,6]). X = PLU_solve(A,b) assert_(np.allclose(x, x0)) 4b) Write a linear solver that utilizes PLU factorization. The cell below has the code for solving Ax = b using LU factorization for reference. You can use the triangular solver functions as is, but modify the general solver as necessary to use PLU instead of LU. Insert your code for your PLU solver in the cell below: In [ ]: def LU_solve(A,b): L,U = LU_factor(A) y = lower_tri_solve(L,b) X = upper_tri_solve(U,y) return x, y def PLU_solve(A,b): solve linear system Ax=b using PLU factorization (Gaussian elimination with pivoting) Args: A: 2D numpy array representing a matrix b: 1D numpy array of right-hand side values Returns: X: 1D numpy array corresponding to solution # Your Code Here In [ ]: b = np.array( [24,7,17]) x0 = np.array( [3,-2,6]). X = PLU_solve(A,b) assert_(np.allclose(x, x0))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
