Re: Function to transform lists
- To: mathgroup at smc.vnet.net
- Subject: [mg22196] Re: [mg22126] Function to transform lists
- From: "Christopher French" <clfrench at msn.com>
- Date: Fri, 18 Feb 2000 02:34:33 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Enrique,
> I need help in order to transform the list A to the list B.
First discover the relationship between your list a and b. If b is a subset
use Position.
(see below for data)
In[ ]:=
Position[a, Alternatives@@b]
Out[ ]=
{{3},{4},{11},{14},{22},{23},{25},{27}}
Then use the position information with the function Extract to transform a.
In[ ]:=
Extract[a,{{3},{4},{11},{14},{22},{23},{25},{27}}] == b
Out[ ]=
True
The important thing here is not to get your hands dirty.
Christopher Lee French
<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>
The secret of magnetism, now explain that to me!
There is no greater secret, except love and hate.
Johann Wolfgang Von Gothe
-----Original Message-----
From: Enrique Cao <cao at mundo-r.com>
To: mathgroup at smc.vnet.net
Subject: [mg22196] [mg22126] Function to transform lists
>Hi All :
>
> I need help in order to transform the list A to the list B.
>
> How can I get a function to do that ?
>
>
>
>
>A = {{{30, -2}},
> {{45, -3}},
> {{60, -4}},
> {{45, -3}, {45, -5}},
> {{30, -2}, {30, -6}},
> {{45, -7}},
> {{60, -8}},
> {{60, -8}, {60, -9}},
> {{60, -8}, {60, -9}, {60, -10}},
> {{60, -8}, {60, -9}, {60, -10}, {60, -11}},
> {{60, -8}, {60, -9}, {60, -10}, {60, -11}, {60, -12}},
> {{45, -7}, {45, -13}}, {{45, -7}, {45, -13}, {45, -14}},
> {{45, -7}, {45, -13}, {45, -14}, {45, -15}},
> {{30, -2}, {30, -6}, {30, -16}},
> {{45, -17}},
> {{45, -17}, {45, -18}},
> {{45, -17}, {45, -18}, {45, -19}},
> {{45, -17}, {45, -18}, {45, -19}, {45, -20}},
> {{45, -17}, {45, -18}, {45, -19}, {45, -20}, {45, -21}},
> {{45, -17}, {45, -18}, {45, -19}, {45, -20}, {45, -21}, {45, -22}},
>{{45, -17}, {45, -18}, {45, -19}, {45, -20}, {45, -21},
>{45, -22},{45, -23}},
>{{30, -2}, {30, -6}, {30, -16}, {30, -24}},
>{{45, -25}},
> {{60, -26}},
> {{45, -25}, {45, -27}},
> {{45, -25}, {45, -27}, {45, -28}}}
>
>
>B = {{{60, -4}},
> {{45, -3}, {45, -5}},
> {{60, -8}, {60, -9}, {60, -10}, {60, -11}, {60, -12}},
> {{45, -7}, {45, -13}, {45, -14}, {45, -15}},
> {{45, -17}, {45, -18}, {45, -19}, {45, -20}, {45, -21},
>{45, -22},{45, -23}},
> {{30, -2}, {30, -6}, {30, -16}, {30, -24}},
> {{60, -26}},
> {{45, -25}, {45, -27}, {45, -28}}}
>
>
>
> Thank you very much
>
> Enrique Cao
>
>cao at mundo-r.com
>
>
>
>
>
>