Re: List element extraction
- To: mathgroup at smc.vnet.net
- Subject: [mg53503] Re: [mg53470] List element extraction
- From: "yehuda ben-shimol" <benshimo at bgumail.bgu.ac.il>
- Date: Fri, 14 Jan 2005 08:55:09 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Note that your list is composed of elements that are also lists. The rule
you want to use is the second element of such internal list.
If we call you list myList
myList={{120.664, {x -> -4.64844}}, {
118.131, {x -> -4.4542}}, {115.479, {x -> -4.25828}}, {
112.697, {x -> -4.06053}}, {109.766, {x -> -3.8606}}, {
106.666, {x -> -3.65812}}, {
103.372, {x -> -3.45257}}, {99.8501, {x -> -3.24323}}, {
96.0571, {x -> -3.02915}}, {
91.9343, {x -> -2.80902}}, {87.3996, {x -> -2.58106}}, {
82.3355, {x -> -2.34305}}, {76.5712, {x -> -2.09251}}, {
69.8594, {x -> -1.8273}}, {61.8567, {x -> -1.54659}}, {
52.1348, {x -> -1.25235}}, {40.3287, {x -> -0.952531}}, {
26.7404, {x -> -0.66784}}, {13.703, {x -> -0.434276}}, {
5.08285, {x -> -0.270745}}, {1.45243, {x -> -0.152066}}};
Then x/.Last/@myList will do the trick.
yehuda
-----Original Message-----
From: Trinanjan Datta [mailto:tdatta at physics.purdue.edu]
To: mathgroup at smc.vnet.net
Subject: [mg53503] [mg53470] List element extraction
How do I extract the x values from the following list and divide them
by 2:
{{120.664, {x -> -4.64844}}, {
118.131, {x -> -4.4542}}, {115.479, {x -> -4.25828}}, {
112.697, {x -> -4.06053}}, {109.766, {x -> -3.8606}}, {
106.666, {x -> -3.65812}}, {
103.372, {x -> -3.45257}}, {99.8501, {x -> -3.24323}}, {
96.0571, {x -> -3.02915}}, {
91.9343, {x -> -2.80902}}, {87.3996, {x -> -2.58106}}, {
82.3355, {x -> -2.34305}}, {76.5712, {x -> -2.09251}}, {
69.8594, {x -> -1.8273}}, {61.8567, {x -> -1.54659}}, {
52.1348, {x -> -1.25235}}, {40.3287, {x -> -0.952531}}, {
26.7404, {x -> -0.66784}}, {13.703, {x -> -0.434276}}, {
5.08285, {x -> -0.270745}}, {1.45243, {x -> -0.152066}}}