Einzelnen Beitrag anzeigen

CalganX

Registriert seit: 21. Jul 2002
Ort: Bonn
5.403 Beiträge
 
Turbo Delphi für Win32
 

Re: Lineare Gleichungssysteme mit n Unbekannten lösen

  Alt 10. Jun 2007, 10:18
mschnell hat die Unit von d3g noch ein wenig verändert. Die entsprechende Unit befindet sich im Anhang, inkl. eines Demoprojektes.
Erläuterungen zur Unit:
Die Gauss/Matrix Unit bietet einige Funktionen zur Mathematik mit Matrizen dynamischer Größe. U.a. Lösung von linearen Gleichungssystemen nach Gauss-Algorithmus. Es werden auch mehrere Gleichungssysteme in einem Schritt berechnet.

Delphi-Quellcode:
// Copyright: Julian und Michel Schnell, Krefeld, Germany, [email]mschnell@bschnell.de[/email]

interface
type
TVector = array of Extended;
TMatrix = array of TVector;

function SolveLinearSystem(A: TMatrix): TVector;
// sloves Ax=y, with A a square martrix
// Parameters:
// A: Matrix with the vector y added "at the right side" to the original A
// so A has a dimension of n, n+1
// Result: solution vector x

function SolveLinearSystems(A: TMatrix): TMatrix;
// sloves AX=Y, with A a square martrix, X and Y matrices with the same hight as A
// Parameters:
// A: Matrix with the matrix y added "at the right side" to the original A
// so A has a dimension of n, n+m (n = height of A, m = height of Y)
// Result: solution matrix X

function MatrixTrans (A: TMatrix) : TMatrix;
// transposes a matrix

function MatrixMulti (A, B: TMatrix) : TMatrix;
// multiplies matrices
// Parameters:
// A and B matrices, width of A = height of A
// Result: A*B

function MatrixVektorMulti (A: TMatrix; V:TVector ) : TVector;
// multiplies a matrix and a vector
// Parameters:
// A matrix, width of A = height of v
// Result: A*v

function MatrixConcat (A, B: TMatrix): TMatrix;
// Adds B to the right side of A
// Parameters:
// matrices A abd B with the same height

function MatrixIdent (n: Integer): TMatrix;
// returns an identity matrix I with dimension n

function MatrixInvert (A: TMatrix) : TMatrix;
// inverts a matrix
// Parameters:
// A a square matrix
// Result: A^-1

procedure MatrixBubbleSort(var A: TMatrix; m: Integer);
// sorts the lines of a matrix so that the column m is ascending
// (in place sort algorithm)
Angehängte Dateien
Dateityp: zip matrix_gauss_981.zip (6,9 KB, 431x aufgerufen)
  Mit Zitat antworten Zitat