Question: 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

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 = for j in range(n): smax=max(smax, abs (A[i][5])) S[i]=smax ###### Block 2 ##### for kin range(n-1): max=0 for i in range(k,n): r = abs(A[1[1]][k]/[1[i]]) if r>rmax: max=r j=i 1[k],[5]=1[3], 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[i]] b[1[i]]=sum/A[1[i]][i] **#### Block 4 ##### X=[@]*n for i in range(n): x[i]=b[1[i]] print(x) Below, summarize what each block of the code above is doing. Block 1: Block 2: Block 3: Block 4: 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 = for j in range(n): smax=max(smax, abs (A[i][5])) S[i]=smax ###### Block 2 ##### for kin range(n-1): max=0 for i in range(k,n): r = abs(A[1[1]][k]/[1[i]]) if r>rmax: max=r j=i 1[k],[5]=1[3], 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[i]] b[1[i]]=sum/A[1[i]][i] **#### Block 4 ##### X=[@]*n for i in range(n): x[i]=b[1[i]] print(x) Below, summarize what each block of the code above is doing. Block 1: Block 2: Block 3: Block 4

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!