MathGroup Archive 2000

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

Search the Archive

Re: How do I manipulate that data?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22481] Re: [mg22403] How do I manipulate that data?
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 4 Mar 2000 02:26:46 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Mark,

Here is a small data list:

data = {{1, 1}, {2, 2}, {3, 3}};

For small sets, this will work:

data /. {x_, y_} -> {x, y^2}
{{1, 1}, {2, 4}, {3, 9}}

For very large set you might want to use this:

Transpose[MapAt[#1^2 & , Transpose[data], 2]]
{{1, 1}, {2, 4}, {3, 9}}

Or this:

({#1[[1]], #1[[2]]^2} & ) /@ data
{{1, 1}, {2, 4}, {3, 9}}

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/




>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
>------------------------------
>
>
>
>



  • Prev by Date: Re: Digitizing points in a graphic
  • Next by Date: Re: Digitizing points in a graphic
  • Previous by thread: Re: How do I manipulate that data?
  • Next by thread: Re: How do I manipulate that data?