Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: row,column question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73371] Re: row,column question
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Wed, 14 Feb 2007 05:21:30 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <eqs94u$ihh$1@smc.vnet.net>

In article <eqs94u$ihh$1 at smc.vnet.net>,
 John Biddiscombe <biddisco at cscs.ch> wrote:

> If I have a 4x4 matrix and I postmultiply by {{1,0,0,bx}} I actually get 
> something like col1 + bx*col4
> 
> Is there any way of telling Mathematica to show the result in a symbolic form 
> using (for example, rows and columns) in this case.

If mat is an m x n matrix, say

  mat = Table[a[i, j], {i, 3}, {j, 4}];

and b is an n-vector, say

  b = {1,0,0,bx};

and c is an m-vector, say

  c = {2,0,cx};

then, after defining

  cols[mat_] := Array[col, Last@Dimensions[mat]]

  rows[mat_] := Array[row, First@Dimensions[mat]]

which, essentially, replaces the matrix, mat, by a symbolic vector of 
columns or rows, one sees that

  cols[mat] . b

  col[1] + bx col[4]

or

  c . rows[mat]

  2 row[1] + cx row[3]

does what you want. You can recover the actual matrix entries as

  % /. {row[i_] :> mat[[i, All]], col[j_] :> mat[[All, j]]}

Cheers,
Paul

_______________________________________________________________________
Paul Abbott                                      Phone:  61 8 6488 2734
School of Physics, M013                            Fax: +61 8 6488 1014
The University of Western Australia         (CRICOS Provider No 00126G)    
AUSTRALIA                               http://physics.uwa.edu.au/~paul


  • Prev by Date: Controlling display of frames in a movie
  • Next by Date: Re: numerical_solution
  • Previous by thread: row,column question
  • Next by thread: Writing to an external file?