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: [mg22451] Re: How do I manipulate that data?
  • From: Brian Higgins <bghiggins at ucdavis.edu>
  • Date: Sat, 4 Mar 2000 02:26:25 -0500 (EST)
  • References: <89iaoe$msi@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <89iaoe$msi at smc.vnet.net>,
  mark griggs <markgriggs at sc.rr.com> wrote:
> 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
>
 Mark,

Here is one way to do it using Map:

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

Map[{#[[1]], #[[2]]^2} &, data]

{{1, 4}, {2, 9}, {3, 16}}

Brian


Sent via Deja.com http://www.deja.com/
Before you buy.


  • Prev by Date: Re: How do I manipulate that data?
  • Next by Date: Mathlink speed
  • Previous by thread: Re: How do I manipulate that data?
  • Next by thread: Re: How do I manipulate that data?