Re: Re: How to reverse sign on the y's in a list of (x, y)'s?

*To*: mathgroup at smc.vnet.net*Subject*: [mg61352] Re: [mg61240] Re: [mg61231] How to reverse sign on the y's in a list of (x, y)'s?*From*: Murray Eisenberg <murray at math.umass.edu>*Date*: Sun, 16 Oct 2005 00:18:05 -0400 (EDT)*Organization*: Mathematics & Statistics, Univ. of Mass./Amherst*References*: <200510130539.BAA04564@smc.vnet.net> <200510140953.FAA28364@smc.vnet.net>*Reply-to*: murray at math.umass.edu*Sender*: owner-wri-mathgroup at wolfram.com

Method 1 fails when "data" is a list of just two pairs of numbers! data = {{1, 2}, {3, 4}}; data /. {a_, b_} -> {a, -b} {{1, 2}, {-3, -4}} curtis wrote: > Hey, > > (**** Method 1: pattern matching ****) > > data = {{0, 1}, {0.1, 1.1}, {0.2, 1.2}, {0.3, 1.3}, {0.4, 1.4}, {0.5, 1.5}, {0.6, > > 1.6}, {0.7, 1.7}, {0.8, 1.8}, {0.9, 1.9}, {1., 2.}} > > data /. {a_, b_} -> {a, -b} > > (**** Method 2: ripping apart, negating, putting back together ****) > > Needs["Statistics`DataManipulation`"] > > Transpose[{Column[data, 1], -Column[data, 2]}] > > > Of course, there are a lot of ways to do the same thing. I'm not sure > what's fastest, but either of these methods works fine for me on > moderately large arrays. > > Cheers, > C. O. > > > > 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! >> >> >> >> > > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305

**References**:**How to reverse sign on the y's in a list of (x, y)'s?***From:*sherifffruitfly@gmail.com

**Re: How to reverse sign on the y's in a list of (x, y)'s?***From:*curtis <gardyloo@mail.wsu.edu>