MathGroup Archive 2000

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

Search the Archive

Re: Newbie question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25297] Re: [mg25275] Newbie question
  • From: BobHanlon at aol.com
  • Date: Tue, 19 Sep 2000 03:45:19 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 9/17/2000 5:52:30 PM, jml at accessinter.net writes:

>I have some numerical data: data:={{x,y},{x1,y1},{x2,y2}....{xn,yn}}, 
>I want to transform the data like this: 
>data1:={{x,1/y},{x1,1/y1},{x2,1/y2}....{xn,1/yn}}, how can I do this 
>transformation? Thanx in advance. Regards
>

data = Transpose[{Array[x, {5}], Array[y, {5}]}];

data1 = data /. {x_, y_} :> {x, 1/y}

{{x[1], 1/y[1]}, {x[2], 1/y[2]}, {x[3], 1/y[3]}, 
  {x[4], 1/y[4]}, {x[5], 1/y[5]}}

or

({#[[1]], 1/#[[2]]} & /@ data) == data1

True


Bob Hanlon


  • Prev by Date: Re: powersum with a function with variable count of parameters
  • Next by Date: Re: Newbie question
  • Previous by thread: Re: Newbie question
  • Next by thread: Re: Newbie question