Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*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 2003

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

Search the Archive

Re: a little more complex list operation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40268] Re: a little more complex list operation
  • From: Bill Rowe <listuser at earthlink.net>
  • Date: Fri, 28 Mar 2003 04:32:43 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 3/27/03 at 6:49 AM, nmoore at physics.umn.edu (Nathan Moore) wrote:

>Suppose I have the list,

>data = {{x1,y1},{x2,y2},{x3,y3}}

>and I want to produce the result (for fitting/plotting)

>data2 = {{f[x1],g[y1]},{f[x2],g[y2]},{f[x3],g[y3]}}

There are a number of ways to do this. For example

{f[#[[1]]],g[#[[2]]]}&/@data1

or equivalently

{f[First[#]],g[Last[#]]}&/@data1

or

MapThread[{f[#1],g[#2]}&,Transpose[data1]]

I am sure there are many other ways I haven't thought of yet as well. Mathematica provides a fairly rich set of tools to manipulate lists.


  • Prev by Date: Re: DSolve and N do not commute
  • Next by Date: 4.2.1 and Fonts
  • Previous by thread: Re: a little more complex list operation
  • Next by thread: Re: a little more complex list operation