MathGroup Archive 2003

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

Search the Archive

Re: proper way to manipulate lists?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40218] Re: [mg40182] proper way to manipulate lists?
  • From: Hugh Walker <hwalker at gvtc.com>
  • Date: Wed, 26 Mar 2003 02:42:23 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On Tuesday, March 25, 2003, at 02:04 AM, Nathan Moore wrote:

>
> I'm sure this is a one-liner, but it has stumped me for years.  Suppose
> I'm working with a 2-d array of data,
> 	data = {{x1,y1},{x2,y2}...{xN,yN}};
> and I want to transform the data according to,
> 	data2 = {{x1*a,y1*b},{x2*a,y2*b}...{xN*a,yN*b}};
> The only way I know to do this is to move the data to excel,
> performing the transform and then move the data back to Mathematica.  
> This
> is crazy - there must be a better way - is there?  Please tell me there
> is!

Let data be a given 2-dimensional list, and vec = {a,b}. Then the 
operation

(vec(data//Transpose))//Transpose

will give the desires result.

=========
Hugh Walker
Gnarly Oaks



  • Prev by Date: Re: List Operation ?
  • Next by Date: Re: proper way to manipulate lists?
  • Previous by thread: Re: proper way to manipulate lists?
  • Next by thread: Re: proper way to manipulate lists?