Forum > General

Pascal Gauss-Jordan

(1/2) > >>

JhonDayStanley:
I need help to make a program that uses the gauss jordan method to solve an equation and prints all the matrix , and the left pivot 1.

Example
4
1 2 3 4
8 14 15 3
9 2 5 8
7 0 2 5
5
6
2
1
End.
It is always a square matrix.

Handoko:
Is it what you're looking for?

http://rosettacode.org/wiki/Gaussian_elimination

JhonDayStanley:
I need it on pascal , here is the program explained, I think is for somebody that has advanced programming skills in pascal , I can't do it and really need help im a newbie.

Linear algebra

You want to create a system that solves systems of equations or inverse matrix (as appropriate). These systems have a square matrix up to 15x15 squares.

The information is given to read a file with the following format:
{Beginning of the input file format}
[N-side size of the matrix]
[Row 1 separate with spaces]
[Row2 separated with spaces]
.
.
.
[Row n separated with spaces]
[Data 1]
[Data 2]
.
.
.
[Data n]
{End of the input file format}

Example:
} {Start of example
4
1 2 3 4
8 14 15 3
9 2 5 8
7 0 2 5
5
6
2
1
{So} example

In the case of inverse matrix solve terms [Data 1] ... [Data n] they are not used.

The system must have the minimum options:

3) Solve problem (show the intermediate matrix and corresponding solution)
4) Exit the system.

lainz:
What you know about Pascal programming in first place?

I can tell how i can i think how it can be solved

Create a tstringlist to load the file
Create another string list and asign with commatext property the next line you need
Convert each string ítem from the secondary string list into an 2d array of integer
Repeat until you finish trading all lines you need, not more not less

From keyboard you can use readln to read the next int one by one use a For loop to set the appropriate ammount of reads
Of course store then in a secondary 2d array of int

You need a third 2d array of int to store the solución but is optional you can only do writeln to show the output
(I think, but i will use the array better For me)

JhonDayStanley:

--- Quote from: lainz on August 25, 2016, 03:16:05 am ---What you know about Pascal programming in first place?

I can tell how i can i think how it can be solved

Create a tstringlist to load the file
Create another string list and asign with commatext property the next line you need
Convert each string ítem from the secondary string list into an 2d array of integer
Repeat until you finish trading all lines you need, not more not less

From keyboard you can use readln to read the next int one by one use a For loop to set the appropriate ammount of reads
Of course store then in a secondary 2d array of int

You need a third 2d array of int to store the solución but is optional you can only do writeln to show the output
(I think, but i will use the array better For me)

--- End quote ---

Well I know the basic , you know cycles , string , arrays , files , records.

I think it needs to be done with arrays , I have seem some codes and they use arrays , a friend found a program that is very similar to the one I want to do but is in french and it doesnt print the pivots , I mean the process in the which it is solving the matrix.