1 / 14

Solution of linear equations using Gaussian elimination

Solution of linear equations using Gaussian elimination. Author: Jon Kleppe NTNU. Assistant producer: Joachim Tro. Introduction. LEARNING GOALS. INTRODUCTION. GAUSSIAN METHOD. GAUSSIAN PROCEDURE. EXERCISE. RESOURCES. REFERENCES. Learning Goals. References. Introduction. Resources.

demi
Download Presentation

Solution of linear equations using Gaussian elimination

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Solution of linear equations using Gaussian elimination Author: Jon Kleppe NTNU Assistant producer: Joachim Tro

  2. Introduction LEARNING GOALS INTRODUCTION GAUSSIAN METHOD GAUSSIAN PROCEDURE EXERCISE RESOURCES REFERENCES Learning Goals References Introduction Resources Gaussiab method Exercise Gaussian procedure

  3. Learning goals LEARNING GOALS INTRODUCTION GAUSSIAN METHOD Learning objectives in this module Develop problem solution skills using computers and numerical methods. Review the Gaussian elimination method for solving simultaneous linear equations. Develop programming skills using FORTRAN New FORTRAN elements in this module use ofNAG-library GAUSSIAN PROCEDURE EXERCISE RESOURCES REFERENCES

  4. Introduction LEARNING GOALS INTRODUCTION GAUSSIAN METHOD Solution of sets of linear equations is required in many petroleum applications. Many methods exist for this purpose, direct methods as well as iterative methods. The reference mentioned in the end may be consulted for a review of such methods. A direct method frequently used in petroleum applications is the Gaussian elimination method, and the simplest form of this method will be discussed below. First, let’s review the concept of simultaneous linear equations. A set of linear simultaneous equations may be written as: GAUSSIAN PROCEDURE EXERCISE RESOURCES REFERENCES .......

  5. Introduction LEARNING GOALS INTRODUCTION GAUSSIAN METHOD GAUSSIAN PROCEDURE EXERCISE RESOURCES REFERENCES ....... Here we have a total of N unknowns (xj, j=1, 2… N), related through M equations. The coefficients in the left sides of the equations (aij, i=1, 2… N ; j=1, 2… M ) are known parameters, and so are also the coefficients on the right side (bi, i=1, 2… M).

  6. Introduction LEARNING GOALS INTRODUCTION GAUSSIAN METHOD The equations may alternatively be written in a compact form: where A is the coefficient matrix, and b is the right hand side vector: GAUSSIAN PROCEDURE EXERCISE RESOURCES REFERENCES If the number of unknowns is equal to the number of equations, N=M, we may be able to solve the set of equations, provided that the equations are unique.

  7. Gaussian elimination method LEARNING GOALS INTRODUCTION GAUSSIAN METHOD For simplicity, let’s use the following set of 3 equations and 3 unknowns, ie. N=3 and M=3, in order to illustrate the Gaussian elimination method: The method starts by multiplying Eq. (4) by –a21/a11 and then add it to Eq. (5). The resulting equation becomes: The set of equation has now become Next, we multiply Eq. (8) by –a’32/a’22 and add it to Eq. (9), so that the set of equations become: This completes the first part of the Gaussian elimination method, called the forward elimination process. GAUSSIAN PROCEDURE (7) EXERCISE (8) RESOURCES (4) REFERENCES (9) (5) (6) (10) (11) (12) We then multiply Eq.(4) by and add it to Eq.(6), resulting in:

  8. LEARNING GOALS Gaussian elimination procedure Gaussian elimination method INTRODUCTION GAUSSIAN METHOD Eq. (12) may now be used to solve directly for x3: After completion of the forward elimination process, determined the last unknown of the vector (x3) by Eq. (13), we will perform a back substitution process. This simply means that as the unknowns are calculated, in our simple example from x3 and downwards, they are substituted into the equations above, and the next unknown may be computed. For Eqs. (12) and (11) this process is carried out as follows: Based on the example above, we may formulate a general procedure for the forward elimination, solution for the last unknown, and back substitution to get the rest of the unknowns 1) Forward elimination: 2) Solving for xN: 3) Back substitution: GAUSSIAN PROCEDURE (13) EXERCISE RESOURCES REFERENCES (14) (15)

  9. 2x +3y +4z -5s +7t = -35 8x -2y -3z +9s +3t = +53 4y +6z -3s -2t = -33 5x -7y +8z +3s -9t = -19 3x +5y -2z +4s +6t = +27 Gaussian elimination procedure LEARNING GOALS INTRODUCTION GAUSSIAN METHOD Make a FORTRAN program consisting of a main program, that reads the coefficients of the system of equations (n, a1,1…an,n , d1…dn) from an input file (IN.DAT) and writes the results (x1…xn) to an out-file (OUT.DAT), and a subroutine, SUBROUTINE GAUSS(X,A,D,N), that uses the Gaussian elimination method in order to solve the set of equations and returns n values of x to the main program Test the program on the following set of equations: GAUSSIAN PROCEDURE EXERCISE RESOURCES REFERENCES Equation

  10. Programming exercise LEARNING GOALS INTRODUCTION GAUSSIAN METHOD The Petra-server includes a NAG-library of scientific subroutines. Find a subroutine in this library (use naghelp) that may be used for solution of simultaneous equations (Gaussian elimination method or some other method). Modify the program above so that is asks you on the screen if you want to use the programmed Gaussian-routine or the NAG-routine for the solution. Check that the solutions from the two methods are identical. (Note that all real variables should be declared as REAL*8 (double precision) since the NAG-routines require this) The NAG-routine may be linked in by the command xlf –o prog fil.f –L/localiptibm3/lib –l nag GAUSSIAN PROCEDURE EXERCISE RESOURCES REFERENCES

  11. Resources LEARNING GOALS INTRODUCTION GAUSSIAN METHOD GAUSSIAN PROCEDURE • Introduction to Fortran • Fortran here • The whole exercise in a printable format here • Web sites • Numerical Recipes • Fortran Tutorial • Professional Programmer's Guide to Fortran77 • Programming in Fortran77 EXERCISE Template RESOURCES REFERENCES

  12. References LEARNING GOALS INTRODUCTION GAUSSIAN METHOD GAUSSIAN PROCEDURE • W. H. Preuss, et al., “Numerical Recipes in Fortran”, 2nd edition • Cambridge University Press, 1992 • References to the textbook : • Gauss Jordan elimination: page 27 • Gaussian Elimination with backsubstitution: page 33 • The Textbook can also be accessed online: • Internet-versjonen av tekstboken Numerical Recipes (Fortran 77) • Internet-versjonen av tekstboken Numerical Recipes (Fortran 90) EXERCISE RESOURCES REFERENCES

  13. About this module LEARNING GOALS INTRODUCTION Title:Solution of linear equations using Gaussian elimination Author: Jon Kleppe Assistant producer(s): Joachim Tro with help from Per Jørgen Dahl Svendsen Size: 1.0 Mb Publication date: 1. August 2003 Abstract: Finding roots of equations using the Newton-Raphson method Software required: PowerPoint XP/XP Viewer Level: 2 Estimated time to complete: 30 minutes GAUSSIAN METHOD GAUSSIAN PROCEDURE EXERCISE RESOURCES REFERENCES

  14. HelpNavigation tools in the module LEARNING GOALS INTRODUCTION On every page, you will find the title at the top, and a menu with the main chapters in bold to the left. These are hyperlinks which enable you choose the chapters in whichever order you wish to view them. Keep in mind that the module is set up in the order the author believes is most appropriate for study. These chapters are also represented with an illustration on the introduction slide linked to the appropriate chapter. The chapter you are currently viewing in is shown with this marker: , while the subchapter (when applicable) is highlighted in orange. Within the main frame (the white area), you’ll find text and illustrations as well as animations and videos etc. Many pictures have enlargement buttons near them. At bottom of the slide you’ll find a few standardised buttons which occur on every page (some may not be present in the module): GAUSSIAN METHOD GAUSSIAN PROCEDURE shows the list of references. EXERCISE shows information about the module (e.g. author and assistant producer). RESOURCES REFERENCES shows a list of frequently asked questions if there are any. takes you to previously viewed slide. is linked to the previous chapter and slide, respectively. Previous picture in an animation or sequence of pictures. is linked to the next chapter and slide, respectively. Next picture in an animation or sequence of pictures. you may turn off the sound, or turn it on (when available). you have figured it out! will end your session with the current module. If you have any problems, please let us know by sending an e-mail to geoscience@learningJOURNALS.net. Please include the title of module and description of the problem. We will respond as quickly as possible.

More Related