Solving linear algebraic eqns. in vector (matrix) notation ?
- Subject: Solving linear algebraic eqns. in vector (matrix) notation ?
- From: Radovan Omorjan
- Date: Sat, 29 Dec 2007 22:53:00 -0800
Dear all!
I am trying to solve some simple linear algebraic system of equations
using array, vector, matrix notation.
Here is my first attempt:
(%i1) n1:makelist(n1[k],k,1,6);
(%o1) [n1 , n1 , n1 , n1 , n1 , n1 ]
1 2 3 4 5 6
(%i2) n2:makelist(n2[k],k,1,6);
(%o2) [n2 , n2 , n2 , n2 , n2 , n2 ]
1 2 3 4 5 6
(%i3) load(eigen);
(%o3) D:/PROGRA~1/MAXIMA~1.0/share/maxima/5.12.0/share/matrix/eigen.mac
(%i4) n1:columnvector(n1);
[ n1 ]
[ 1 ]
[ ]
[ n1 ]
[ 2 ]
[ ]
[ n1 ]
[ 3 ]
(%o4) [ ]
[ n1 ]
[ 4 ]
[ ]
[ n1 ]
[ 5 ]
[ ]
[ n1 ]
[ 6 ]
(%i5) n2:columnvector(n2);
[ n2 ]
[ 1 ]
[ ]
[ n2 ]
[ 2 ]
[ ]
[ n2 ]
[ 3 ]
(%o5) [ ]
[ n2 ]
[ 4 ]
[ ]
[ n2 ]
[ 5 ]
[ ]
[ n2 ]
[ 6 ]
(%i6) S: matrix([-1,0],[1,-1],[0,1],[1,0],[-1/2,-1/2],[0,0]);
[ - 1 0 ]
[ ]
[ 1 - 1 ]
[ ]
[ 0 1 ]
[ ]
(%o6) [ 1 0 ]
[ ]
[ 1 1 ]
[- - - - ]
[ 2 2 ]
[ ]
[ 0 0 ]
(%i7) eps:columnvector(makelist(eps[k],k,1,2));
[ eps ]
[ 1 ]
(%o7) [ ]
[ eps ]
[ 2 ]
(%i8) m: n1-n2+S.eps;
[ - n2 + n1 - eps ]
[ 1 1 1 ]
[ ]
[ - n2 + n1 - eps + eps ]
[ 2 2 2 1 ]
[ ]
[ - n2 + n1 + eps ]
[ 3 3 2 ]
[ ]
(%o8) [ - n2 + n1 + eps ]
[ 4 4 1 ]
[ ]
[ eps eps ]
[ 2 1 ]
[ - n2 + n1 - ---- - ---- ]
[ 5 5 2 2 ]
[ ]
[ n1 - n2 ]
[ 6 6 ]
So far so good!. I was trying to figure out how to solve the column
vector m (every element equals to 0) ie. 6 linear equations in 6
variables. What should I do in order to find, say, vector n2[k],k,1,6 (I
know how to assign values to other variables - if needed)?. On the other
hand, I suppose there must be some other, more elegant way to work with
and solve equations with indexed variables. I might missing something
but could not find in Maxima book or help any examples of this kind.
Any comments are appreciated.
Regards,Radovan