4
► Mini Projects ► Source Code ► Student Projects ► C++ Code C Program for Gauss Elimination Method March 28, 2014 in Numerical Methods 5 Comments In engineering and science, the solution of linear simultaneous equations is very important. Different analysis such as electronic circuits comprising invariant elements, a network under steady and sinusoidal condition, output of a chemical plant and finding the cost of chemical reactions in such plants require the solution of linear simultaneous equations. In Gauss-Elimination method, these equations are solved by eliminating the unknowns successively. The C program for Gauss elimination method reduces the system to an upper triangular matrix from which the unknowns are derived by the use of backward substitution method. Pivoting, partial or complete, can be done in Gauss Elimination method. So, this method is somewhat superior to the Gauss Jordan method. This approach, combined with the back substitution, is quite general. It is popularly used and can be well adopted to write a program for Gauss Elimination Method in C. For this, let us first consider the following three equations: a1x + b1y + c1z = d1 a2x + b2y + c2z = d2 a3x + b3y + c3z = d3 Assuming a1 0, x is eliminated from the second equation by subtracting (a2/ a1) times the first equation from the second equation. In the same way, the C code presented here eliminates x from third equation by subtracting (a3/a1) times the first equation from the third equation. Then we get the new equations as: a1x + b1y + c1z = d1 b’2y + c’2z = d’2 c’’3z = d’’3 The elimination procedure is continued until only one unknown remains in the last equation. After its value is determined, the procedure is stopped. Now, Gauss Elimination in C uses back substitution to get the values of x, y and z as: z= d’’3 / c’’3 y=(d’2 – c’2z) / b’2 x=( d1- c1z- b1y)/ a1 Find us on Facebook Codewithc.com 780 people like Codewithc.com. Facebook social plugin Like Hospital Management System Project in C May 23, 2014 C/C++ Projects & Mini Projects with Source Codes ‐34% ‐29% AIPMT Question Bank 2015 Get AIPMT Question Bank To Revise Weakest Concepts From All Chapters. ‐34% ‐34% ‐29% ‐29% Popular Recent Comments Tags Final Year Projects Java Projects ASP.NET Projects Android Projects PHP Projects VB.NET Projects C++ Projects C Projects Downloads

1C Program for Gauss Elimination Method _ Code With C

Embed Size (px)

DESCRIPTION

rgt

Citation preview

  • 1/13/2015 CProgramforGaussEliminationMethod|CodewithC

    http://www.codewithc.com/cprogramforgausseliminationmethod/ 1/4

    Tuesday, January 13, 2015

    Code with CC Tutorial Numerical Methods Algorithms & Flowcharts How To ? Search...

    MiniProjects SourceCode StudentProjects C++Code

    C Program for Gauss Elimination MethodMarch 28, 2014 in Numerical Methods 5 Comments

    In engineering and science, the solution oflinear simultaneous equations is veryimportant. Different analysis such as electroniccircuits comprising invariant elements, anetwork under steady and sinusoidalcondition, output of a chemical plant andfinding the cost of chemical reactions in suchplants require the solution of linearsimultaneous equations.

    In Gauss-Elimination method, these equationsare solved by eliminating the unknownssuccessively. The C program for Gausselimination method reduces the system to anupper triangular matrix from which theunknowns are derived by the use of backward substitution method.

    Pivoting, partial or complete, can be done in Gauss Elimination method. So, this method is somewhatsuperior to the Gauss Jordan method. This approach, combined with the back substitution, is quitegeneral. It is popularly used and can be well adopted to write a program for Gauss Elimination Methodin C.

    For this, let us first consider the following three equations:

    a1x + b1y + c1z = d1a2x + b2y + c2z = d2a3x + b3y + c3z = d3

    Assuming a1 0, x is eliminated from the second equation by subtracting (a2/ a1) times the first equationfrom the second equation. In the same way, the C code presented here eliminates x from third equationby subtracting (a3/a1) times the first equation from the third equation.

    Then we get the new equations as:

    a1x + b1y + c1z = d1b2y + c2z = d2c3z = d3

    The elimination procedure is continued untilonly one unknown remains in the lastequation. After its value is determined, theprocedure is stopped. Now, GaussElimination in C uses back substitution toget the values of x, y and z as:

    z= d3 / c3y=(d2 c2z) / b2x=( d1- c1z- b1y)/ a1

    Find us on Facebook

    Codewithc.com

    780peoplelikeCodewithc.com.

    Facebooksocialplugin

    Like

    Hospital Management SystemProject in CMay 23, 2014

    C/C++ Projects & Mini Projects with Source Codes

    34% 29%

    AIPMT Question Bank2015

    Get AIPMT Question Bank ToRevise Weakest Concepts From All

    Chapters.

    34% 34%

    29% 29%

    Popular Recent Comments Tags

    Final Year Projects Java Projects ASP.NET Projects Android Projects PHP Projects VB.NET Projects C++ Projects C Projects Downloads

  • 1/13/2015 CProgramforGaussEliminationMethod|CodewithC

    http://www.codewithc.com/cprogramforgausseliminationmethod/ 2/4

    SourceCodeforGaussEliminationMethodinC:

    Input/Output:

    Also see,Gauss Elimination Algorithm and FlowchartNumerical Methods Tutorial Compilation

    The source code for Gauss Elimination in C needs to compiled in Code::Blocks. The program is tested andis bug-free. If you have any queries regarding Gauss Elimination Method or its program aforementioned,bring them up from the comments box.

    DownloadMay 3, 2014

    Payroll Management System Projectin C++July 22, 2014

    How to include graphics.h inCodeBlocks?April 17, 2014

    Mini Project in C Snake GameApril 4, 2014

    123456789101112131415161718192021222324252627282930313233343536373839404142434445464748

    #includeint main(){ int i,j,k,n; float A[20][20],c,x[10],sum=0.0; printf("\nEnter the order of matrix: "); scanf("%d",&n); printf("\nEnter the elements of augmented matrix row-wise:\n\n"); for(i=1; i

  • 1/13/2015 CProgramforGaussEliminationMethod|CodewithC

    http://www.codewithc.com/cprogramforgausseliminationmethod/ 3/4

    Share ! Tweet 1 2

    5 comments

    DownloadSourceCodeC++CodeScienceProjects

    3Like Share

    Previous:C Program for Fixed Point IterationMethod Next:C Program for Gauss-Jordan Method

    December 16, 2014 at 8:08 pmPatrik

    Please, what is meaning of: x[n]=A[n][n+1]/A[n][n]; I dont get itReply

    November 26, 2014 at 7:32 pmAnonymous

    Can you also include the function of partial pivoting in this program?Reply

    September 4, 2014 at 12:36 pmPavan

    your program is not working for some special matrices , u should improve the program in such a way thatit has to work for all types of matrices

    Reply

    September 4, 2014 at 1:32 pmPramesh Pudasaini

    Really? What do you mean by some special matrices?Reply

    November 30, 2014 at 10:50 amPassingBy

    E.g. matrix, where at some point element on the main diagonal will be equal 0.You should try https://en.wikipedia.org/wiki/Elementary_matrix#Operations

    Reply

    Leave a ReplyYour email address will not be published. Required fields are marked *

    Name *

    Email *

    Website

    PostComment

  • 1/13/2015 CProgramforGaussEliminationMethod|CodewithC

    http://www.codewithc.com/cprogramforgausseliminationmethod/ 4/4

    Home|AboutUs|ContactUs|PrivacyPolicy|TermsofUse

    Copyright20142015CodewithC.Allrightsreserved.