Solving a linear equation

后端 未结 10 1852
悲哀的现实
悲哀的现实 2020-11-27 06:47

I need to programmatically solve a system of linear equations in C, Objective C, or (if needed) C++.

Here\'s an example of the equations:

-44.3940 =          


        
10条回答
  •  生来不讨喜
    2020-11-27 07:33

    In terms of run-time efficiency, others have answered better than I. If you always will have the same number of equations as variables, I like Cramer's rule as it's easy to implement. Just write a function to calculate determinant of a matrix (or use one that's already written, I'm sure you can find one out there), and divide the determinants of two matrices.

提交回复
热议问题