SECTION 11.4 GAUSS-SEIDEL

The Gauss-Seidel method is an iterative method for solving simultaneous equations. It is not guaranteed to converge. Write the equations as


		x1 = f1(x1,...,xn)
	         .................
		xn = fn(x1,...,xn)
or as

		x1 = f1(x2,...,xn)
	         .................
		xn = fn(x1,...,xn-1)

The algorithm substitutes the starting values on the right hand side, calculates the left-hand sides, resubstitutes these values on the right and iterates like that until either convergence takes place, the iteration limit is exceeded, or divergence occurs.

In order to call the algorithm, issue the command

       CALL GAUSSEID(X,FPD,NP,ITERL,ACC,EQUS,IER)
where
      X    = the REAL*8 vector of variables dimensioned X(NP) (input)
      FPD  = the REAL*8 vector of right hand sides dimensioned FPD(NP) (computed)
      NP   = the number of variables (input)
      ITERL= iteration limit (input)
      ACC  = accuracy required (e.g., 0.00001) (input)
      EQUS = the name of the subroutine that evaluates the right hand sides (user provided)
      IER  = error return (output); =0 for convergence, =-3 if NP>200,=-1 if iteration limit
	         exceeded, =-69 if divergence occurred.
		 
Before calling the subroutine, be sure to issue the command
       CALL DFLT
The SUBROUTINE EQUS may be named arbitrarily, but its name must be declared in an EXTERNAL EQUS statement in the MAIN program. The subroutine should have the following structure:
           SUBROUTINE EQUS(X,FPD,NP,IER)
           IMPLICIT REAL*8 (A-H,O-Z)
	  DIMENSION X(NP),FPD(NP)
	  IER=0
	  FPD(1)=....
	  FPD(2)=....
	  ...........
	  FPD(NP)=....
	  RETURN
	  END

If errors may occur in the evaluation of any FPD, the program should test for such errors, and if one occurs, IER should be set to -1 before returning.

div align="center">Return to

|Beginning|SHELL|