Not Yet Answered # Gauss or Gauss Jordan elimination

gusano79 247 gusano79 247 Discussion Starter Jakub_2 Discussion Starter Jakub_2 Discussion Starter Jakub_2 Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...

0

What kind of help do you need? Problems with the algorithm? Locating/using a library?

0

Alright, have you tried writing any code yet? If so, please post it.

Starting at the beginning: How are you representing matrices?

0

I have procedure which takes data from a file and writes them then I have problem with main procedure of Gauss :/ I will post it tomorrow now I need to go sleep gn :)

0

Ok I found I did it bad... Now Im trying to do it right just have 2 days for it... Any help will 100% help me with it..

0

I actually did that but Im not sure if its 100% right..

```
program gauss;
uses crt;
const max=10;
type matrix = array[1..max,1..max] of real;
var a:matrix;
i,j,f,g,e,N,M:integer;
y:real;
c,d:boolean;
inFile : text;
inFileName : string;
procedure readFile(var A : matrix);
var i,j : integer;
begin i := 1; j := 1;
while not eof(inFile) do
begin
j := 1;
while not eoln(inFile) do
begin
read(inFile,a[i,j]);
inc(j);
end;
readln(inFile);
inc(i);
end;
close(inFile);
end;
procedure zero (m:integer; var A:matrix);
var n,k:integer;
z:real;
begin
n:=m;k:=m;
while (A[m,n]=0) and (M<=N) do
begin
m:=m+1;
if A[m,n]<>0 then
for n:=1 to N+1 do
begin
z:=A[m,n];
A[m,n]:=A[k,n];
A[k,n]:=z;
end;
end;
end;
begin
writeln('Name of the input file?: ');
readln(inFileName);
assign(inFile,inFileName);
reset(inFile);
readln(inFile,N,M);
d:=false;
readFile(a);
for i:=1 to N-1 do
begin
zero(i,a);
for e:=1 to N-i do
begin
if a[i+e,i]<>0 then
begin
y:=a[i+e,i]/a[i,i]*(-1);
for j:=1 to n+1 do
begin
a[i,j]:=a[i,j]*y;
a[i+e,j]:=a[i+e,j]+a[i,j];
end;
end;
end;
for f:=i to n do
begin
c:=false;
for g:=1 to N do c:=(a[f,g]<>0) or c;
if not(c) then d:=a[f,N+1]=0;
end;
end;
if c then
begin
for j:=n downto 1 do
begin
for e:=j+1 to n do a[j,N+1]:=a[j,N+1]-a[j,e];
a[N+1,j]:=a[j,N+1]/a[j,j];
for i:=1 to j-1 do a[i,j]:=a[i,j]*a[N+1,j];
end;
for j:=1 to n do
writeln('x',j,'= ',a[N+1,j]:4:2);
end
else if d then writeln('The equation has infinitely solutions !')
else writeln('The equation has no solution !');
repeat until keypressed;
end.
```

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

When I execute this progammatically, I get a table with row heights much larger than when I do this manually.

Note : Sel is the Word.Selection object and the Clipboard contains an Excel Table.

```
public void AddClipboard()
{
Sel.PasteExcelTable(false,false, false);
var t = Sel.Tables[Sel.Tables.Count];
t.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitContent);
}
```

the function that I created to find the ...