Re: How do I manipulate that data?
- To: mathgroup at smc.vnet.net
- Subject: [mg22457] Re: How do I manipulate that data?
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sat, 4 Mar 2000 02:26:29 -0500 (EST)
- References: <89iaoe$msi@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Mark, My tmp file looks like !! tmp 0.341719 0.990566 0.505954 0.28635 0.663925 0.309206 Read it in, as you do, data = ReadList["tmp", {Real, Real}] {{0.341719, 0.990566}, {0.505954, 0.28635}, {0.663925, 0.309206}} Square the second entry in each row data /. {{x_Real, y_Real} :> {x, y^2}} {{0.341719, 0.981221}, {0.505954, 0.0819963}, {0.663925, 0.0956084}} It's probably better to get the raw data in this case, but we can use ReadList["tmp", Unevaluated[{#1, #2^2} &[Real, Real]]] {{0.341719, 0.981221}, {0.505954, 0.0819963}, {0.663925, 0.0956084}} Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "mark griggs" <markgriggs at sc.rr.com> wrote in message news:89iaoe$msi at smc.vnet.net... > Hello all, > I have a data file called data.txt. It consists of 2 columns of > data. I am able to read with > data = ReadList["/home/mark/data.txt", {Real, Real}]; I let the first > column represent x and the second represent y. Then I plot y vs. x > with ListPlot[data]. My problem is that I need to plot y^2 vs. x. > So, how can I square all the y terms? > > regards > > mark > > > > > -- > Heisenburg may have slept here > ------------------------------ > > >