Re: lower diagonal matrix

*To*: mathgroup at smc.vnet.net*Subject*: [mg80429] Re: lower diagonal matrix*From*: Ray Koopman <koopman at sfu.ca>*Date*: Wed, 22 Aug 2007 04:45:30 -0400 (EDT)*References*: <fae9s7$eai$1@smc.vnet.net>

On Aug 21, 2:05 am, Sean Bonness <nbonn... at chem.ucsb.edu> wrote: > Hello... > > I am in need of some help in trying to convert data I got from > another program into mathematica so that I can eventually diagonalize > the matrix. What I have from the other program are values for a lower > diagonal matrix, which corresponds to a full symmetric matrix and > whereby the program tries to save on writing alot of data by just > writing the lower diagonal matrix. The values I have from another > program are in a five column by 56 row matrix. The first element > (1,1) in this matrix corresponds to the (1,1) element in a lower > diagonal matrix, the second element (1,2) corresponds to (2,1), the > third (1,3) corresponds to (2,2), the fourth (1,4) corresponds to > (3,1), the fifth (1,5) corresponds to (3,2), the sixth (2,1) > corresponds to (3,3) and so on. What I have done so far is read in > the data into mathematica, but when I do it reads it in as a one > dimensional list. What I would like to do is to break up the data > into a human readable form of a lower diagonal matrix and then > construct a full symmetric (23x23) matrix of this data so as to > eventually diagonalize and solve it. The lower diagonal elements are > the same as the upper diagonal elements, so I understand that I would > need to specify the elements to be a[i,j]=a[j,i] somewhere in > defining the symmetric matrix. Any help in trying to help me write/ > construct the full symmetric matrix from the data I have would be > much appreciated. Here's a toy example for a 4 x 4 matrix: k[i_,j_] := #(#-1)/2&@Max[i,j] + Min[i,j] Table[k[i,j],{i,4},{j,4}] {{1, 2, 4, 7}, {2, 3, 5, 8}, {4, 5, 6, 9}, {7, 8, 9, 10}} t = Flatten@Table[Random[],{2},{5}] {0.963279, 0.290362, 0.347601, 0.300672, 0.184255, 0.249541, 0.666380, 0.371960, 0.026704, 0.187856} Table[t[[k[i,j]]],{i,4},{j,4}] {{0.963279, 0.290362, 0.300672, 0.666380}, {0.290362, 0.347601, 0.184255, 0.371960}, {0.300672, 0.184255, 0.249541, 0.026704}, {0.666380, 0.371960, 0.026704, 0.187856}}