Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*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 1999

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

Search the Archive

Re: Manipulating a list of pairs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19733] Re: [mg19689] Manipulating a list of pairs
  • From: BobHanlon at aol.com
  • Date: Mon, 13 Sep 1999 02:41:01 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Hans,

lumpi[{f_, amp_}] := {f, Power[2 Pi f, 2] U / amp};

thelist = 
    Table[ToExpression[
        "{x" <> ToString[k] <> ", y" <> ToString[k] <> "}"], {k, 5}];

The following expressions are equivalent

lumpi /@ thelist == 
  ({#1[[1]], (2*Pi*#1[[1]])^2*U/#1[[2]]} & ) /@ thelist == 
  (thelist /. {x_, y_} :> {x, (2*Pi*x)^2*U/y}) == 
  Cases[thelist, {x_, y_} :> {x, (2*Pi*x)^2*U/y}] == 
  MapThread[{#1, (2*Pi*#1)^2*U/#2} & , Transpose[thelist]]

True

However, I don't think they are any easier nor are they any easier to 
understand.

Bob Hanlon

In a message dated 9/11/1999 9:42:15 PM, 
hans.steffani at e-technik.tu-chemnitz.de writes:

>I have a list of pairs and manipulate it with things like
>
>lumpi[{f_, amp_}]:={f, Power[2 Pi f,2] U / amp}
>Map[ lumpi, thelist]
>
>is there an easier way without introducing "lumpi" to do this?
>


  • Prev by Date: Re: compressed list output
  • Next by Date: Re: contourplots
  • Previous by thread: Re: Manipulating a list of pairs
  • Next by thread: Re: Manipulating a list of pairs