{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CE 311K Lab9 Pt2

# CE 311K Lab9 Pt2 - CE311K Introduction to Computer Methods...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 ! CE311K Introduction to Computer Methods ! Lab9 - Systems of Linear Equations Program lab9 ! Declaration of Variables real a(50,50), b(50), x(50) integer n, i, j real er, tol ! Open I/O files Input file called input.txt, output file out.dat Open(unit=5, file='input2.txt',status='old') Open(unit=6, file='out2.dat', status='unknown') ! Initialization of the Matrix ! Read(5,*) n ! Reads the number of equations to solve ! Loop to store matrix of coefficients in a, and array of constants in b Do i=1,n read (5,*) (a(i,j), j=1,n), b(i) x(i)=0 Enddo print *, 'Input Matrix: ' write (6,*) 'Input Matrix' call printer(a, n, b, j) !Calls function that prints system of equations !a Matrix of coefficients of nxj !b Array of constants of nx1 ! er: error code, tol: tolerable number ! +initialize er at zero er=0 ! +set tolerance error as 1E-8 tol=1e-8 call Gauss(a, b, n, x, tol, er) ! +Write solutions to a file remember solutions are in the array x call printsol(n, j, x) End program lab9 ! Subroutine dealing with Gauss Elimination

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

CE 311K Lab9 Pt2 - CE311K Introduction to Computer Methods...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online