Question: Using the pseudo-code provided, write a FORTRAN program, named gauss. 190 that implements Gaussian Elimination with Partial Pivoting that will solve systems of linear equations.

 Using the pseudo-code provided, write a FORTRAN program, named gauss. 190
that implements Gaussian Elimination with Partial Pivoting that will solve systems of

Using the pseudo-code provided, write a FORTRAN program, named gauss. 190 that implements Gaussian Elimination with Partial Pivoting that will solve systems of linear equations. You should test your program with several examples. Here are two examples from the textbook that you can use! Example 1: Oxy + 2xy + xy + x4 - 0 2x + 2xy + 3x3 + 2x = -2 4x - 3x2 +0x3 + x4 = -7 6x + x2 - 6x, -5x = 6 Correct answers x,- 2*3-1,3- --2 numRowSwaps = 0 ! Initialize number of row swaps For col = 1 to (n-1) ! Initialize some needed variables pivotValue = A (col, col)l ! A value on the main mainDiagonalRow = col ! The corresponding rov pivot Row = mainDiagonal Row ! Find the correct pivot row (largest absolute value For row = (col+1) ton If (1A (row, col) > pivotValue) Then pivotValue = A (row, col) | pivotRow = row End If End for ! Switch Rows (pivotRow & mainDiagonal Row) if necess If (pivotRow not equal mainDiagonalRow) Then Add i to numRowSwaps ! Swap rows in matrix A For k = 1 ton Tmp = A (mainDiagonal Row, k) A (mainDiagonal Row, k) = A (pivotRow, k) A (pivotRow, k) = Tmp End for ! Swap values in the vector b as well Tmp = b (mainDiagonalRow) b(mainDiagonalRow) = b (pivotRow) b(pivotRow) = Tmp End If ! Check for singular matrix (Avoid division by 0 lat If (Acol, col)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!