Re: How to reverse sign on the y's in a list of (x, y)'s?
- To: mathgroup at smc.vnet.net
- Subject: [mg61267] Re: [mg61231] How to reverse sign on the y's in a list of (x, y)'s?
- From: János <janos.lobb at yale.edu>
- Date: Fri, 14 Oct 2005 05:54:09 -0400 (EDT)
- References: <200510130539.BAA04564@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Oct 13, 2005, at 1:39 AM, sherifffruitfly at gmail.com wrote: > Hi all, > > This is really dumb, but I just don't know how to do it... > > Import from excel gives me a list of ordered pairs, and I want the 2nd > element of each pair to be of opposite sign. Sticking the negative > sign > in front of the entire Import statement reverses both the 1st and the > 2nd elements (duh). How do I get just the second item to reverse sign? > > thanks! Here is a newbie approach: In[1]:= lst = Table[{x, (-1)^i*y}, {i, 1, 5}] Out[1]= {{x, -y}, {x, y}, {x, -y}, {x, y}, {x, -y}} In[2]:= newlst = ({#1[[1]], -#1[[2]]} & ) /@ lst Out[2]= {{x, y}, {x, -y}, {x, y}, {x, -y}, {x, y}} János ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice)
- References:
- How to reverse sign on the y's in a list of (x, y)'s?
- From: sherifffruitfly@gmail.com
- How to reverse sign on the y's in a list of (x, y)'s?