# Thread: Help with programming matrix in pascal

1. ## Help with programming matrix in pascal

I'm doing project, and it's point is solving system of linear equations so I need some method to solve them.Unfortunantly, I'm not good at solving it on the paper, especially not know how to write a code for it...Which is the easiest way to do that, and if possible, could someone tell me where can I find a code ?Since, it's not a point of the project(it's educational), and I thought of using matrix...

I'm doing project, and it's point is solving system of linear equations so I need some method to solve them.Unfortunantly, I'm not good at solving it on the paper, especially not know how to write a code for it...Which is the easiest way to do that, and if possible, could someone tell me where can I find a code ?Since, it's not a point of the project(it's educational), and I thought of using matrix...
Do you know Cramer's Method?

I'm doing project, and it's point is solving system of linear equations so I need some method to solve them.Unfortunantly, I'm not good at solving it on the paper, especially not know how to write a code for it...Which is the easiest way to do that, and if possible, could someone tell me where can I find a code ?Since, it's not a point of the project(it's educational), and I thought of using matrix...
Given a system of linear equations. The ultimate way to solve this system is to use Gaussian-Jordan elimination. With this method you do not have to worry if the system is consistent or indepentent, whether it has infinitely many solutions or whether it has no solutions at all. You can have more equations than variables and you can have more variables than equations. There is no limitation on this method. It is absolute, it can solve anyting. It might not seem as elegant as Cramer's method but it is a lot faster in computability speed.

4. Hm, I don't know....What do you suggest me?
BTW, this is the pseudocode for the whole procedure ?

Code:
i := 1
j := 1
while (i ≤ m and j ≤ n) do
Find pivot in column j, starting in row i:
maxi := i
for k := i+1 to m do
if abs(A[k,j]) > abs(A[maxi,j]) then
maxi := k
end if
end for
if A[maxi,j] ≠ 0 then
swap rows i and maxi, but do not change the value of i
Now A[i,j] will contain the old value of A[maxi,j].
divide each entry in row i by A[i,j]
Now A[i,j] will have the value 1.
for u := i+1 to m do
subtract A[u,j] * row i from row u
Now A[u,j] will be 0, since A[u,j] - A[i,j] * A[u,j] = A[u,j] - 1 * A[u,j] = 0.
end for
i := i + 1
end if
j := j + 1
end while