matrix manipulation using transformations
- To: mathgroup at yoda.physics.unc.edu
- Subject: matrix manipulation using transformations
- From: Michael Carter <ECON076 at cantva.canterbury.ac.nz>
- Date: Tue, 01 Jun 1993 15:44:43 +1200
I am trying to write some matrix manipulations using patterns and transformations. Can any one help me understand the following: For example to divide each row by its last element, this works fine for row 2: m /. m[[2]] :> m[[2]] / m[[2,3]] but replacing 2 by k doesn't. m /. m[[k_]] :> m[[k]] /m[[k,3]] yielding the error messages: Part::pspec: Part specification k_ is neither an integer nor a list of non-zero integers. Part::pspec: Part specification k_ is neither an integer nor a list of non-zero integers. I think I can understand why Mma might treat 2 and k differently; but is there an elegant way to do what I want?? Michael Carter +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Michael Carter m.carter at csc.canterbury.ac.nz Department of Economics voice: + 64 3 364 2524 University of Canterbury fax: + 64 3 364 2635 Private Bag 4800 Christchurch NEW ZEALAND