Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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: [mg66387] Re: Creating a new table using values from a column in another table,
  • From: "Scout" <Scout at nodomain.com>
  • Date: Thu, 11 May 2006 02:15:32 -0400 (EDT)
  • References: <e3sgqp$lsf$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Wonko the Sane" <noone at nowhere.com> news:e3sgqp$lsf$1 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
>
Hi Michael,
let's assume your data points are only 4:
    In[1]:= t1 = {{x1, y1}, {x2, y2}, {x3, y3}, {x4, y4}};

Hence,
    In[2]:= t2 = Transpose[t1]
    Out[2]= {{x1, x2, x3, x4}, {y1, y2, y3, y4}}

    In[3]:= {#, f[#]} & /@ t2[[1]]
    Out[3]= {{x1, f[x1]}, {x2, f[x2]}, {x3, f[x3]}, {x4, f[x4]}}


Best regards,
    ~Scout~



  • Prev by Date: Re: Rules
  • 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,