程序代写代做代考 Sequential Jacobi:

Sequential Jacobi:
const TOLERANCE = …
main() {
int n = …
double A[n,n], B[n,n]
double maxdiff = 0.0, diff
bool done := false
initialize A, B
while not done {
for i := 1 to n-2
for j := 1 to n-2
A[i][j] := (B[i][j-1] + B[i][j+1] + B[i-1][j] + B[i+1][j]) / 4 diff := abs(A[i][j] – B[i][j])
if maxdiff < diff maxdiff := diff } } if maxdiff < TOLERANCE done := true else { swap(A,B) maxdiff := 0 } } } print out "answer"