/* prog4a.c -- Solve Least Linear System by Gauss Seidel Method Written Feb 20, 2001 by Eric Olson for Mathematics 483 For more information see Step 13 in First Steps in Numerical Analysis, 2nd Edition, by Hosking, Joe, Joyce and Turner. */ #include #include #define MAXn 40 static double a[MAXn][MAXn]; static double b[MAXn]; static int n; int gauss_seidel(double x[MAXn]){ double y[MAXn]; double s; int iter=0; do{ int i; iter++; s=0.0; for(i=0;i1.0e+32 || iter>10000) return 0; } while(s>1.0e-5); return iter; } outmatrix(double a[MAXn][MAXn]){ int i,j; printf("["); for(i=0;iMAXn) { puts("Capacity exceeded!"); exit(1); } { int i,j; for(i=0;i