MathGroup Archive 2003

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

Search the Archive

Re: a little more complex list operation


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