MathGroup Archive 2002

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

Search the Archive

Re: Appending to a matrix?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38545] Re: Appending to a matrix?
  • From: Mark Westwood <MarkCWestwood at compuserve.com>
  • Date: Wed, 25 Dec 2002 03:12:46 -0500 (EST)
  • References: <au9hen$pt1$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Jeremy,

Start by loading the Add-On Package for Matrix Manipulation:

<< LinearAlgebra`MatrixManipulation`

Then, something like:

a = {1,2,3},{4,5,6},{7,8,9}}
b = {{1},{1},{1}}
c = AppendRows[a, b]

should give you the augmented matrix you are looking for.

To get the vertical line between the third and fourth columns of your
augmented matrix you could use the Option Inspector, which is found on
the Format menu.  First select the cell containing the matrix whose
formatting you want to fine-tune.  Then open the Option Inspector. 
Select the Formatting Options, then Table/Matrix/Palette Formatting,
then Line Drawing Options and finally set the Column Lines to {False,
False, True} (* the curly brackets are important *).  This should get
you started, you can figure out the details yourself ...

Finally, to multiply the final column of the row-reduced matrix by
rising powers of x do something like: 

Transpose the row-reduced matrix and select the last row - this will
give you a row vector which represents the final column of the
row-reduced matrix.  Then take the dot product of this with the vector
{1,x,x^2}.  There are a number of ways of doing this, if you can't
figure it out, email me and I'll provide further guidance.

If you want to make the procedure a bit more useful, you could replace
the vector {1,x,x^2} by an equivalent construction such as Table[x^n,
{n,0,Length[vectorToDotMultiplyWith]-1}]

Hope this helps

Mark Westwood


Jeremy wrote:
> 
> How do I append a column vector to the end of a matrix in mathematica?
> 
> For example, I want to turn:
> [1 2 3]     [1]
> [4 5 6] and [1]
> [7 8 9]     [1]
> 
> into
> 
> [1 2 3 1]
> [4 5 6 1]
> [7 8 9 1]
> 
> Or, actually,
> 
> [1 2 3 | 1]
> [4 5 6 | 1]
> [7 8 9 | 1]
> 
> Not that it really matters.
> 
> Also, is there a way that I can stick the entries of a row reduced matrix
> onto powers of x's?  Like
> 
> [1 0 0 | 1]
> [0 1 0 | 2]
> [0 0 1 | 3]
> 
> to
> 
> 1 + 2x + 3x^2
> ?
> 
> Many thanks,
> Jeremy
> 
> --


  • Prev by Date: Re: RE: Re: How to animate?
  • Next by Date: help on nonlinear ODEs
  • Previous by thread: RE: Appending to a matrix?
  • Next by thread: techexplorer