Re: Newbie question

• To: mathgroup at smc.vnet.net
• Subject: [mg25335] Re: [mg25275] Newbie question
• From: David Chapman <d.a.chapman at open.ac.uk>
• Date: Sat, 23 Sep 2000 03:35:58 -0400 (EDT)
• Organization: The Open University
• References: <8q78ca\$t81@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Several people have suggested this approach, but note what happens if
you have two data points:

In[1]:=
data = {{a, b}, {c, d}};

In[2]:=
data /. {x_, y_} -> {x, 1/y}

Out[2]=
{{a, b}, {1\c, 1\d}}

I guess this is something you always have to watch for with the 'pattern
matching' approach.

David

Hugh Walker wrote:
>
> >Hi Mathgroup,
> >
> >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
> >
> >Jose M Lasso
> ========
> Hi Jose. This will do it
>
> data = {{a, b}, {c, d}, {e, f}}
> data /. {x_, y_} -> {x, 1/y}
>
> Have fun!
>
>     ==
>
> Hugh Walker
> Gnarly Oaks

```

• Prev by Date: Differential operators, Help
• Next by Date: Re: matrix indices
• Previous by thread: Re: Newbie question
• Next by thread: Limit of sequence