Matrix solver with complex numbers Name: MATRXCPX Author: Jorge R. Molineros G. joms67@hotmail.com / rmolineros@easynet.net.ec Version: 0.1 TI device: TI-83 Released: September 6, 2002 Description: Numerical solution for a system of equations with complex coeficients using matrix and the row reduced echelon formula. ------------ Instructions ------------ Run MATRXCPX Enter the dimension of the matrix of coeficients A N x M (N) (M) Enter the coeficients of A Enter the solution B Example: we have the system o equations : (1-i)x1+(1+i)x3=1+i -x1-ix2+(-1-i)x3=-1 x2+ix3=-i so puting in Ax=B [ 1-i 0 1+i ] [x1] [ 1+i ] [ -1 -i -1-i ] [x2] = [ -1 ] [ 0 1 i ] [x3] [ -i ] A x = B A is a matrix N x M M >= N N = 3 M = 3 The input of data begin with the row #1 and then all the columns when you finsish with one row you begin the other in this case you have to begin with 1-i then 0 and then 1+i , and then the next row -1 , -i , -1-i and so until finish then you enter the solution B in order in this case is 1+i , -1 , -i and the answer will be in the matrix D in the order real , complex if you check matrix D this will be shown [ 1 0 0 0 0 0 -.5 ] [ 0 1 0 0 0 0 1 ] [ 0 0 1 0 0 0 -.5 ] [ 0 0 0 1 0 0 -1 ] [ 0 0 0 0 1 0 0 ] [ 0 0 0 0 0 1 -.5 ] Now you are wondering its supposed to have three answers not six ! , now remember about the order of real , complex , ok here are the solutions x1 = -.5 + i x2 = -.5 - i x3 = -.5i the first answer is the real part of x1 and the second answer is the complex part pf x1 and so the real part of x2 is the 3rd answer and the complex the 4th answer . Now you got it a real complex number matrix solver. I develop this program because in analisys of electric circuits you need to use complex numbers in system of equations, so i realy dont wanna buy a Hp - 49g so i began writing this program. Now i will tell you about the matematic secret of this program. so you have a system of equations on a matrix with complex numbers like this one [ a(1,1)+b(1,1)i a(1,2)+b(1,2)i ] [ x ] [ f1+g1i ] = [ a(2,1)+b(2,1)i a(2,2)+b(2,2)i ] [ Y ] [ f2+g2i ] a(j,k) means j indicate row in the answer the number in f1 k indicate column indicates that is different from f2 and the same for g1 and g2 so x and y the incognits are complex numbers too x = c1+d1i ; y = c2+d2i now [a(1,1)+b(1,1)i][c1+d1i]+[a(1,2)+b(1,2)i][c2+d2i] = f1+g1i (1) [a(2,1)+b(2,1)i][c1+d1i]+[a(2,2)+b(2,2)i][c2+d2i] = f2+g2i (2) multiplicating term by term you will have a real part and a complex part for (1) and (2) so the real and complex part for (1) will be a(1,1)c1 - b(1,1)d1 + a(1,2)c2 - b(1,2)d2 = f1 (3) b(1,1)c1 + a(1,1)d1 + b(1,2)c2 + a(1,2)d2 = g1 (4) (3) its the ecuation of the real part and (4) the equation of the complex part the same for (2) a(2,1)c1 - b(2,1)d1 + a(2,2)c2 - b(2,2)d2 = f2 (5) b(2,1)c1 + a(2,1)d1 + b(2,2)c2 + a(2,2)d2 = g2 (6) (5) real part (6) complex part now we want to know c1 , d1 , c2 and d2 because they are components of x and y so this system forms a matrix of 4x4 [ a(1,1) -b(1,1) a(1,2) -b(1,2) ] [ c1 ] [ f1 ] [ b(1,1) a(1,1) b(1,2) a(1,2) ] [ d1 ] [ g1 ] = [ a(2,1) -b(2,1) a(2,2) -b(2,2) ] [ c2 ] [ f2 ] [ b(2,1) a(2,1) b(2,2) a(2,2) ] [ d2 ] [ g2 ] then this system is reduced with rref and thats all folks you got x and y I know this is not a demostration and i supossed the demostration would be very long , but this works with all the dimentions that the memory can support. -------------- Known Problems -------------- Of course there is a restriction and that is that in the matrix A n x m , m must be mayor or equal to n. It had never failed to me believe me boys if you have a problem please send me an e-mail. If you find any bug, have any ideas for improvements or just want to send a comment, please contact me DO NOT SEPARATE THIS DOCUMENT FROM THIS PROGRAM! Copyright (C) 2002 Jorge Molineros