MathGroup Archive 1999

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

Search the Archive

Re: Multiply a constant to a matrix column

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16339] Re: Multiply a constant to a matrix column
  • From: phbrf at t-online.de (Peter Breitfeld)
  • Date: Sun, 7 Mar 1999 01:05:54 -0500
  • Organization: das ist ein breites Feld ...
  • References: <7bo0gg$dop@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hyo ahn <heahn at nanum.kaeri.re.kr> schrieb:
> Hi,
> 
> I would like to multiply a constant number to a certain column of an existing
> matrix in Mathematica and I am having a hard time.
> 
> First, I have a 1000 x 3 matrix A.  There is no command that allow me to
> multiply a constant number to a specific column (let say I want to multiply
> 100 to the second column), so I extract three columns
> separately using
> 
> A1 = A[Range[1,1000],Range[1,1]];
> A2 = A[Range[1,1000],Range[2,2]];
> A3 = A[Range[1,1000],Range[3,3]];
> 
> Then I multiply a constant to a extracted
> column which is a vector now.   So I did
> 
> A2b = 100 A2;
> 
> Then I recombined the columns as
> 
> A4 = ColumnJoin[A1,A2b,A3]
> 
> but I found out that ColumnJoin command does not worked the way I expected
> it to be.
> 
> Could anyone know a simple solution to this problem?

I don't know how fast and memory consuming this will be for big
matrices, but you can try:

At=Transpose[A]; At[[2]]=100*At[[2]]; A=Transpose[At]
 

es gruesst
      Peter
-- 
=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
  Peter Breitfeld, Saulgau, Germany       (PGP public key: 08548045)


  • Prev by Date: Re: "ExtendGraphics`Contour`"
  • Next by Date: RE: Front End Stalls When Not On Network
  • Previous by thread: Re: Multiply a constant to a matrix column
  • Next by thread: Re: Multiply a constant to a matrix column