0

I need to solve a system of n-linear equations with n-unknown variables in C++ using the gaussian method of elimnation. Any hints how to achieve that? I'll be probably using rand(); for the amount of n, since isn't available, because C++11 I can't use.

4pie0
  • 29,204
  • 9
  • 82
  • 118
user3182683
  • 101
  • 8
  • 2
    There is this cool new tool out called, "google." Give it a try. Seriously, SO is not the correct forum for these types of questions. I found [this link](http://ww2.odu.edu/~agodunov/teaching/notes/Nm06_matrix2a.pdf) in 2 seconds – OldProgrammer Jan 22 '14 at 17:46
  • The technique of Gaussian elimination has been known for centuries, so it really shouldn't require "hints." Just look it up. Which specific part of the task are you having trouble with? – Rob Kennedy Jan 22 '14 at 17:51
  • Google "gaussian elimination". First link is the Wikipedia article, which describes the process and provides an example. – comingstorm Jan 23 '14 at 00:20

1 Answers1

3

to solve a linear system

AX=B

you need to invert a matrix A, which results in A^(-1) and multiply A^(-1) * B to obtain X. This is the example code to invert non-singular matrix using Gauss - Jordan elimination algorithm (complexity is O(n^3)):

matrix inversion using Gauss-Jordan elimination

4pie0
  • 29,204
  • 9
  • 82
  • 118