Solving Linear Equations in Computer Programs
Date: 02/13/2003 at 01:38:46 From: Venkatasubramani Subject: Best method to solve linear equations in computer programs? Dear Dr. Math, Could you please tell me the best and simplest method in computer programs, among the following, for solving linear equations of the form x + y = 3 2x + y = 4 1) Cramers method 2) Gaussian Elimination method 3) Inverse matrix method Thank you.
Date: 02/13/2003 at 02:26:02 From: Doctor Jacques Subject: Re: Best method to solve linear equations in computer programs? Hello and thank you for writing to Dr Math. The "best" choice depends somewhat on what you want to be able to do. If you only want to solve 2*2 systems like the one above, I would recommend Cramer. For larger systems you should, in general, use Gaussian elimination. Note that, in a "real" computer program (to be used for real-world applications), there are various things to consider in order to minimise the amount of rounding error. You should only use the inverse matrix if you have to solve many different systems with the same left-hand side; in this case, you need to invert the matrix only once (and save the inverse), and this allows you to compute solutions with different right-hand sides by using only multiplications and additions. Inverting an n*n matrix is equivalent to solving n systems of n equations - the additional work only pays off if you can re-use the inverse. In this case, you should also note that the problems of rounding errors can be even more serious. - Doctor Jacques, The Math Forum http://mathforum.org/dr.math/
Search the Dr. Math Library:
Ask Dr. MathTM
© 1994-2013 The Math Forum