Re: Manipulating a list of pairs
- To: mathgroup at smc.vnet.net
- Subject: [mg19720] Re: Manipulating a list of pairs
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Mon, 13 Sep 1999 02:40:54 -0400
- References: <7reco3$46o@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hans Steffani <hans.steffani at e-technik.tu-chemnitz.de> wrote in message news:7reco3$46o at smc.vnet.net... > > 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? > > Hans Friedrich Steffani > -- > Hans Friedrich Steffani > Institut fuer Elektrische Maschinen und Antriebe, TU Chemnitz > mailto:hans.steffani at e-technik.tu-chemnitz.de > http://www.tu-chemnitz.de/~hfst/ > Hans, Pure functions (anonymous functions) are useful for this sort of thing: Two ways: {#[[1]], Power[2 Pi #[[1]], 2] U/#[[2]]} & /@ thelist {{1, 2*Pi^2*U}, {3, 9*Pi^2*U}} {#1, Power[2 Pi #1, 2] U/#2} & @@@ thelist {{1, 2*Pi^2*U}, {3, 9*Pi^2*U}} A @@@ B means Apply[A, B, {1}] (new in version 4.0) Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565