RE: List Operation ?
- To: mathgroup at smc.vnet.net
- Subject: [mg40217] RE: [mg40204] List Operation ?
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 26 Mar 2003 02:42:18 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Sunil,
We seem to be getting list questions today, and Mathematica is great at
manipulating lists.
For your example...
data = Table[{a[i], b[i], c[i], d[i], e[i], f[i]}, {i, 1, 5}]
{{a[1], b[1], c[1], d[1], e[1], f[1]},
{a[2], b[2], c[2], d[2], e[2], f[2]},
{a[3], b[3], c[3], d[3], e[3], f[3]},
{a[4], b[4], c[4], d[4], e[4], f[4]},
{a[5], b[5], c[5], d[5], e[5], f[5]}}
Just Map (/@) the pure function that picks out the 1st, 2nd and 4th parts of
an expression, onto the data list.
Part[#, {1, 2, 4}] & /@ data
{{a[1], b[1], d[1]},
{a[2], b[2], d[2]},
{a[3], b[3], d[3]},
{a[4], b[4], d[4]},
{a[5], b[5], d[5]}}
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Sunil Jayatilleke [mailto:sunilj at physics.uc.edu]
To: mathgroup at smc.vnet.net
I have a list as follows
list1 =
{{a1,b1,c1,d1,e1,f1},{a2,b2,c2,d2,e2,f2},{............}.............}
Now I want to do the following
list2 ={{a1,b1,d1},{a2,b2,d2}......................}
How can I do that ?
thanks
SJ