Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The code below gives the algorithm for Gaussian Elimination with scaled partial pivoting. Below the code, summarize what each block in the code is doing
The code below gives the algorithm for Gaussian Elimination with scaled partial pivoting. Below the code, summarize what each block in the code is doing [] def GESPP(A,b): n=len(A) # number of rows of A m=len(A[1]) # number of cols of A 1=[@]*n S=[@]*n ###### Block 1 ##### for i in range(n): 1[i]=i smax = 0 for j in range(n): smax=max(smax, abs (A[i][5])]) s[i]=smax **#### Block 2 ##### for k in range(n-1): rmax=0 for i in range(k,n): r = abs(A[1[1]][k]/5[1[i]]) if r>rmax: rmax=r jui 1[k],[3)-1(31,1[k] for i in range(k+1,n): xmult = A[1[1]][k]/A[1[k]][k] #A[1[i]][k]=xmult for j in range(k+1,n): A[1[i]][j]=A[1[i]][j]-(xmult)*A[1[k]][j] b[1[i]]=b[1[1]]-(mult)* b[1[k]] ###### Block 3 ##### b[1[n-1]]=b[1[n-1]]/A[1 [n-1]] [n 1] for i in range(n-2,-1,-1): sum=b[1[1]] for j in range (i+1,n): Sum=sum-A[1[1]][j]*b[1[1]] b[1[i]]=sum/A[1[1]][i] ###### Block 4 ##### X=[@]*n for i in range(n): x[i]=b[1[1]] print(x) Below, summarize what each block of the code above is doing. Block 1: Block 2: Block 3: Block 4: Let 1 3 -4 A=2 -7 2 (1 -2 4 and let = [0,-3, 3] Then there is a unique solution to Az = b. Show you work below to find the solution 7 using Gaussian elimination with scaled partial pivoting Show work here In the code box below, check the result you got by hand using both NGE and GESPP codes. The code below gives the algorithm for Gaussian Elimination with scaled partial pivoting. Below the code, summarize what each block in the code is doing [] def GESPP(A,b): n=len(A) # number of rows of A m=len(A[1]) # number of cols of A 1=[@]*n S=[@]*n ###### Block 1 ##### for i in range(n): 1[i]=i smax = 0 for j in range(n): smax=max(smax, abs (A[i][5])]) s[i]=smax **#### Block 2 ##### for k in range(n-1): rmax=0 for i in range(k,n): r = abs(A[1[1]][k]/5[1[i]]) if r>rmax: rmax=r jui 1[k],[3)-1(31,1[k] for i in range(k+1,n): xmult = A[1[1]][k]/A[1[k]][k] #A[1[i]][k]=xmult for j in range(k+1,n): A[1[i]][j]=A[1[i]][j]-(xmult)*A[1[k]][j] b[1[i]]=b[1[1]]-(mult)* b[1[k]] ###### Block 3 ##### b[1[n-1]]=b[1[n-1]]/A[1 [n-1]] [n 1] for i in range(n-2,-1,-1): sum=b[1[1]] for j in range (i+1,n): Sum=sum-A[1[1]][j]*b[1[1]] b[1[i]]=sum/A[1[1]][i] ###### Block 4 ##### X=[@]*n for i in range(n): x[i]=b[1[1]] print(x) Below, summarize what each block of the code above is doing. Block 1: Block 2: Block 3: Block 4: Let 1 3 -4 A=2 -7 2 (1 -2 4 and let = [0,-3, 3] Then there is a unique solution to Az = b. Show you work below to find the solution 7 using Gaussian elimination with scaled partial pivoting Show work here In the code box below, check the result you got by hand using both NGE and GESPP codes
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