Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: List element extraction

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53489] Re: [mg53470] List element extraction
  • From: DrBob <drbob at bigfoot.com>
  • Date: Fri, 14 Jan 2005 08:54:36 -0500 (EST)
  • References: <200501130812.DAA03802@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

Here are a couple of ways:

data={{120.664,{x\[Rule]-4.64844}},{118.131,{
             x\[Rule]-4.4542}},{115.479,{x\[Rule]-4.25828}},{112.697,{
             x\[Rule]-4.06053}},{109.766,{x\[Rule]-3.8606}},{106.666,{
             x\[Rule]-3.65812}},{103.372,{x\[Rule]-3.45257}},{99.8501,{
             x\[Rule]-3.24323}},{96.0571,{x\[Rule]-3.02915}},{91.9343,{
             x\[Rule]-2.80902}},{87.3996,{x\[Rule]-2.58106}},{82.3355,{
             x\[Rule]-2.34305}},{76.5712,{x\[Rule]-2.09251}},{69.8594,{
             x\[Rule]-1.8273}},{61.8567,{x\[Rule]-1.54659}},{52.1348,{
             x\[Rule]-1.25235}},{40.3287,{x\[Rule]-0.952531}},{26.7404,{
             x\[Rule]-0.66784}},{13.703,{x\[Rule]-0.434276}},{5.08285,{
             x\[Rule]-0.270745}},{1.45243,{x\[Rule]-0.152066}}};
x/2/.%[[All,-1]]
x/2/.Cases[data,a_Rule:>{a},Infinity]

{-2.32422,-2.2271,-2.12914,-2.03027,-1.9303,-1.82906,-1.72629,-1.62162,-1.\
51458,-1.40451,-1.29053,-1.17153,-1.04626,-0.91365,-0.773295,-0.626175,-0.\
476266,-0.33392,-0.217138,-0.135373,-0.076033}

{-2.32422,-2.2271,-2.12914,-2.03027,-1.9303,-1.82906,-1.72629,-1.62162,-1.\
51458,-1.40451,-1.29053,-1.17153,-1.04626,-0.91365,-0.773295,-0.626175,-0.\
476266,-0.33392,-0.217138,-0.135373,-0.076033}

Bobby

On Thu, 13 Jan 2005 03:12:14 -0500 (EST), Trinanjan Datta <tdatta at physics.purdue.edu> wrote:

> 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}}}
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: Problem with transformation rule of a function
  • Next by Date: Re: Re: Mathematica is not very clever
  • Previous by thread: Re: List element extraction
  • Next by thread: Re: List element extraction