============================================================================ LINSYS.DOC ============================================================================ LINSYS is a Turbo Pascal program that solves linear systems. The systems can be determined or not (homogeneous, etc.). If the system is not determined, then is given its general solution. The greatest quantity of equations allowed is given by MaxM = 20 defined in MATRICES unit interface. The greatest quantity of variables is given by MaxN = 20. The main procedure used by LINSYS is called SolveSystem and is defined in MATRICES unit. Its syntax is procedure SolveSystem(mat: matrix; var solution: answer); where matrix and answer are the following records: matrix = record m, n: byte; { m, n = quantities of rows, columns of matrix } a: array[1..MaxM, 1..(MaxN + 1)] of real; { matrix's elements } end; vector = array[1..MaxN] of real; answer = record ParticularSolution: vector; { system's particular solution } x: matrix; { general solution matrix } homogeneous, { tells whether the system is homogeneous } impossible, { tells whether the system is impossible } DetSyst, { tells whether the system is determined } ManyEq: boolean; { tells whether the system has too many } end; { equations } The program must have the {$E+,N+,F+} and {$M 65000, 0, 650000} compiler directives to use the types and procedure above. At least one data must be entered as a parameter: the rational or real format that will be presented the solution. If the first parameter is a 'X', then the format will be real (XX.XXXX, etc.); if it is a 'Q', then the format will be rational (p/q), if q <= 200 or p = 1. A second parameter is allowed too. If the second parater is a 'R' then system's matix will be generated ramdomly; if it is 'K' (default), then system's matrix will be entered by keyboard, in the usual format. For example, a command like [C:\] LINSYS X R generates ramdom systems and shows the solution in the real format. The matrices elements can be entered in form of arithmetic expres- sions like -3/7, 2^10, etc. The allowed operations are only / (division) and ^ (power). Parenthesis can not be used. One blank separates consecu- tive matrix elements. The last column of system's matrix will be the constants coeffici- ents of system. For example, the system 38x - 74y + 46z + 84t = 90 -95x + 185y - 115z - 210t = -225 57x - 111y + 69z + 126t = 135 will be entered as 38 -74 46 84 90 -95 185 -115 -210 -225 57 -111 69 126 135 If the solution format is the rational, the answer will be ( 45/19 0 0 0 ) + k1*( 37/19 1 0 0 ) + + k2*( -23/19 0 1 0 ) + + k3*( -42/19 0 0 1 ) , where k1, k2, k3 are any real number. If the solution format is real, then will be presented ( 2.3684 0.0000 0.0000 0.0000 ) + k1*( 1.9474 1.0000 0.0000 0.0000 ) + + k2*( -1.2105 0.0000 1.0000 0.0000 ) + + k3*( -2.2105 0.0000 0.0000 1.0000 ) If the system is homogeneous, the vectors that generate the general solution are a basis of the subespace solution. Remember that the way to show the general solution is not unique. We can say that (t - 1, t, t + 1, t + 2), t any real, is the solution of a given linear system or say that ((5t - 4)/7, (5t + 3)/7, (5t + 10)/7, (5t + 17)/7) is also the general solution of the same system. We always can substitute t by f(t) in the general solution, where f is a bijective function from R to R. If the quantity of equations is greater than the quantity of variables, then will be showed the message TOO MANY EQUATIONS. In this case, the found solution is the solution of the system only if some rows are deleted. The deleted rows are those that stay in last positions after some matrices operations had been made. Every presented solution is tested. The messages SOLUTION TESTED, PARTICULAR SOLUTION TESTED or GENERAL SOLUTION TESTED mean that everything is okay. Any message different from these mean that something is bad. The MATRICES unit also contains an interesting function that can write some rational numbers in the p/q form, if q <= 200 or p = 1. Its syntax is function Rat(x: real; tam1, tam2: byte): string Rat always returns a string of length tam1; it returns x in format tam1:tam2 if x can not be written in form p/q. For example Rat(0.5, 3, 1)= '1/2', Rat(Pi, 6, 2) = ' 3.14', Rat(0.3333333, 8, 2) = ' 1/3', etc. See the SYSDEMO.PAS, a small source program that demonstrates the usage of the procedure and types showed above. All the procedures or data types mentionated before are only a small part of the Computational Linear Algebra Project, that is a colection of programs in permanent evolution. It's probabily available at the same place you got these files. Any comment or hint will be apreciated if you send them to CCENDM03@BRUFPB.BITNET. ============================================================================