Re: matrix manipulation
- To: mathgroup at smc.vnet.net
- Subject: [mg132415] Re: matrix manipulation
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Mon, 10 Mar 2014 04:41:33 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <20140308074331.2B3106A1D@smc.vnet.net>
Here's one way (assuming Mathematica 9). I omit the "[i]" part so as not to further obscure my code; you may readily insert it. And I chance upper-case C to lower-case c (it's best to avoid at least those upper-case letters that have built-in meaning). topIndices = Select[Flatten[Outer[List, Range[6], Range[6]], 1], First@# <= Last@# &]; pattern = {k_, j_} -> Rule[{k, j}, Subscript[c, k, j]]; mat = Normal@ SymmetrizedArray[topIndices /. pattern, {6, 6}, Symmetric[{2, 1}]] SymmetricMatrixQ[mat] (* True *) On Mar 8, 2014, at 2:43 AM, dimanag78 at gmail.com wrote: > Hello to all. > > I have the following 6x6 matrix > > Table[Subscript[C, k, j][i], {k, 1, 6}, {j, 1, 6}] > > I want this matrix to be symmetric, that is, > Subscript[C, k, j][i] = Subscript[C, j, k][i] for j != k. > > In other words I want the matrix > > {{Subscript[C, 1, 1][i], Subscript[C, 1, 2][i], Subscript[C, 1, 3][i], > Subscript[C, 1, 4][i], Subscript[C, 1, 5][i], > Subscript[C, 1, 6][i]}, {Subscript[C, 1, 2][i], > Subscript[C, 2, 2][i], Subscript[C, 2, 3][i], Subscript[C, 2, 4][i], > Subscript[C, 2, 5][i], > Subscript[C, 2, 6][i]}, {Subscript[C, 1, 3][i], > Subscript[C, 2, 3][i], Subscript[C, 3, 3][i], Subscript[C, 3, 4][i], > Subscript[C, 3, 5][i], > Subscript[C, 3, 6][i]}, {Subscript[C, 1, 4][i], > Subscript[C, 2, 4][i], Subscript[C, 3, 4][i], Subscript[C, 4, 4][i], > Subscript[C, 4, 5][i], > Subscript[C, 4, 6][i]}, {Subscript[C, 1, 5][i], > Subscript[C, 2, 5][i], Subscript[C, 3, 5][i], Subscript[C, 4, 5][i], > Subscript[C, 5, 5][i], > Subscript[C, 5, 6][i]}, {Subscript[C, 1, 6][i], > Subscript[C, 2, 6][i], Subscript[C, 3, 6][i], Subscript[C, 4, 6][i], > Subscript[C, 5, 6][i], Subscript[C, 6, 6][i]}} > > > Thank you very much, in advance, for yor help. > =97=97 Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 240 246-7240 (H) University of Massachusetts 710 North Pleasant Street Amherst, MA 01003-9305
- References:
- matrix manipulation
- From: dimanag78@gmail.com
- matrix manipulation