Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(input) How to write a Fortran code? Programming tasks Implement the Gaussian elimination algorithm without pivoting as described in the lecture notes The algorithm should

image text in transcribedimage text in transcribed(input)

How to write a Fortran code?

Programming tasks Implement the Gaussian elimination algorithm without pivoting as described in the lecture notes The algorithm should be implemented in a separate subroutine "gaussElim", which is to be contained in a module linearSolvers". Your subroutine should conform to the following interface specifications receive the LHS matrix A (as a 2D array) and the RHS vector c (as a 1D array): e return the solution x ( return an integer error code indicating success/failure of the algorithm. as a 1D array); Test your subroutine using the examples from t he notes. For this, use a main program that: reads the matrix A and vector c from a file linear-system" in" (available from MyUni); . uses ALLOCATABLE arrays to store the matrix in the main program; e writes the results to a file "solution.txt" (this code structure make good sense, especially as you gain experience with programming, but if you are still struggling with programming, use a simpler approach so that you know what you are doing) Important note Although the notes/slides do contain significant portions of a Gaussian elimination code, you are advised to develop your own code from scratch. This effort will advance your programming skills much more than if you just copy-paste an existing code and tweak it, and will pay off when facing the sheer increase in programming complexity that can be anticipated in Assignments 2 4 Analysis tasks 1. Check your newly developed code against at least 2 examples from the notes, and against 1 test problem of your own design. Provide a brief justification of your choice of test problems. 2. Ensure your code does not crash when small pivots are encountered (hint: you want to avoid division by zero and return an intelligent message to the user if this happens) Extension task 1. If you are comfortable programming, augment the Gaussian elimination subroutine with a partial pivoting procedure. Describe the logistics of this upgrade, i.e., what sequence of work steps did you undertake when incorporating partial pivoting and why. Programming tasks Implement the Gaussian elimination algorithm without pivoting as described in the lecture notes The algorithm should be implemented in a separate subroutine "gaussElim", which is to be contained in a module linearSolvers". Your subroutine should conform to the following interface specifications receive the LHS matrix A (as a 2D array) and the RHS vector c (as a 1D array): e return the solution x ( return an integer error code indicating success/failure of the algorithm. as a 1D array); Test your subroutine using the examples from t he notes. For this, use a main program that: reads the matrix A and vector c from a file linear-system" in" (available from MyUni); . uses ALLOCATABLE arrays to store the matrix in the main program; e writes the results to a file "solution.txt" (this code structure make good sense, especially as you gain experience with programming, but if you are still struggling with programming, use a simpler approach so that you know what you are doing) Important note Although the notes/slides do contain significant portions of a Gaussian elimination code, you are advised to develop your own code from scratch. This effort will advance your programming skills much more than if you just copy-paste an existing code and tweak it, and will pay off when facing the sheer increase in programming complexity that can be anticipated in Assignments 2 4 Analysis tasks 1. Check your newly developed code against at least 2 examples from the notes, and against 1 test problem of your own design. Provide a brief justification of your choice of test problems. 2. Ensure your code does not crash when small pivots are encountered (hint: you want to avoid division by zero and return an intelligent message to the user if this happens) Extension task 1. If you are comfortable programming, augment the Gaussian elimination subroutine with a partial pivoting procedure. Describe the logistics of this upgrade, i.e., what sequence of work steps did you undertake when incorporating partial pivoting and why

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions