CE 311K Lab9 Pt1

CE 311K Lab9 Pt1 - ! CE311K Introduction to Computer...

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

View Full Document Right Arrow Icon
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='input.txt',status='old') Open(unit=6, file='out.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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/17/2008 for the course CE 311K taught by Professor Liljestrand during the Spring '08 term at University of Texas.

Page1 / 4

CE 311K Lab9 Pt1 - ! CE311K Introduction to Computer...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online