This files provices routines for the Gauß-Jordan scheme.
Some functions for the demonstration of the Gauß-Jordan algorithm. These functions can be used for linear systems or for the simplex algorithm.
Load the functions with "load gaussjordan".
function gjprint (A : real, n : positive integer vector, v : string vector, digits:nonnegative integer=none, length:index=none) Print the matrix A in Gauß-Jordan form. The scheme A is printed in the form x y ... a 1 2 ... b 3 4 ... ... n : index vector with a permumatin of the variables v : variable names with the column variables first digits : number of digits for each number length : output length of each number File: gaussjordan See:
gjstep (Gauß-Jordan Scheme)
function gjstep (A:numerical, i:index, j:index, n:positive integer vector=none, v:string vector=none, digits:nonnegative integer=none, length:index=none) Make A[i,j]=1 and all other elements in column j equal to 0. The function is using elementary operations on the rows of A. Use this functions for the demonstration of the Gauss algorithm. The function modifies A and n. n : A row vector of indices, the function assumes the Gauß-Jordan form. n contains the indices of the variables, first the indices of the variables in the rows, and then the indices of the variables in the columns. The row variable i is exchanged with the column variable j. This is the same as makeing the j-th column to an canonical vector e[i], and inserting in the j-th column the result of this operation applied to e[i]. If n is present, you can add a vector v of strings, which contains the names of the variables. The problem will then be printed using gjprint. File: gaussjordan See:
pivotize (Linear Algebra),
gjprint (Gauß-Jordan Scheme)
function gjsolution (M : real, n : positive integer vector) Read the values of the solution from the Gauß-Jordan scheme. For this, we assume that the last column contains the values, and the variables in the top row are set to zero. See:
gjstep (Gauß-Jordan Scheme)
function gjvars (M : real, simplex=false) Generate variable names for M simplex : If true the last row variable will be named "" and the last column will name will be missing. Returns {v,n} where n=1:(rows+cols), v=["s1"...,"x1",...] See:
gjprint (Gauß-Jordan Scheme)
function gjaddcondition (M : real, n:positive integer vector, v:string vector, line:real vector, varname:string) Add a condition to the Gauß-Jordan Form The line for the condition (left side <= right side) and the variable name must be provided. The condition uses the current top row variables. Return {M,n,v}