MathGroup Archive 2006

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

Search the Archive

RE: Creating a new table using values from a column in another table,

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66409] RE: [mg66346] Creating a new table using values from a column in another table,
  • From: "David Park" <djmp at earthlink.net>
  • Date: Thu, 11 May 2006 02:17:04 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Michael,

data = Table[{x[i], y[i]}, {i, 5}]
{{x[1], y[1]}, {x[2], y[2]}, {x[3], y[3]}, {x[4], y[4]}, {x[5], y[5]}}

data /. {x_, y_} -> {x, f[x]}
{{x[1], f[x[1]]}, {x[2], f[x[2]]}, {x[3], f[x[3]]}, {x[4], f[x[4]]}, {x[5],
    f[x[5]]}}

{First[#], f[First[#]]} & /@ data
{{x[1], f[x[1]]}, {x[2], f[x[2]]}, {x[3], f[x[3]]}, {x[4], f[x[4]]}, {x[5],
    f[x[5]]}}

Give a good email address and you won't have to wait until the next day for
an answer.

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



From: Wonko the Sane [mailto:noone at nowhere.com]
To: mathgroup at smc.vnet.net


Hi all,

I have a question that I have not been able to work out myself, and so
put it to the group to help. I have a set of data points in a table (2
columns {{x1,y1},{x2,y2},....,{xn,yn}}) I have performed a fit to the
data and have a function f[x] which I would now like to evaluate at each
data point (column 1 of the first table) to get a new table
{{x1,f[x1]},{x2,f[x2]},....,{xn,f[xn]}}. Is there a way to do this? I
hope my request is clear

Best Regards
Michael



  • Prev by Date: Re: Creating a new table using values from a column in another table,
  • Next by Date: Re: Creating a new table using values from a column in another table,
  • Previous by thread: Re: Creating a new table using values from a column in another table,
  • Next by thread: Re: Creating a new table using values from a column in another table,