Re: a little more complex list operation
- To: mathgroup at smc.vnet.net
- Subject: [mg40244] Re: a little more complex list operation
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 28 Mar 2003 04:28:08 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <b5uoth$lks$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
a) {f[#[[1]]], g[#[[2]]]} & /@ data
b) Transpose[Map @@@ Transpose[{{f, g}, Transpose[data]}]]
c) Transpose[MapAt[f /@ # &, MapAt[g /@ # &, Transpose[data], {2}],
{1}]]
d) MapAt[g, MapAt[f, data, Table[{i, 1}, {i, 1, Length[data]}]],
Table[{i, 2}, {i, 1, Length[data]}]]
and several more.
Regards
Jens
Nathan Moore wrote:
>
> Thanks very much for all the previous replies. Another simple question -
> though I guess this will require more complex syntax. 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]}}
>
> I assume that if there was only one transform I wanted to apply, f[x],
> then I could say
> data2 = f[data]
> but how about this more complicated transform with functions f and g?
>
> again thanks! Your replies have been very helpful!
>
> Nathan Moore, University of Minnesota Physics