Re: Applying a list of 2D paramters to a mathematica function
- To: mathgroup at smc.vnet.net
- Subject: [mg68072] Re: Applying a list of 2D paramters to a mathematica function
- From: "g.omikron" <g.omikron at gmail.com>
- Date: Fri, 21 Jul 2006 17:36:17 -0400 (EDT)
- References: <e9q9l1$83q$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Dear Curry, i remember i had the same problem which i finally solved... Unfortunatelly, i don' t remember its final solution but i remember also that a permanent solution was to modify my initial function definition from f[x_,y_] := x + y; to f[{x_, y_}] := x + y; if you do this, i suppose you can get the values of the elements of lists like the one below testList = {{a, b},{c, d}, ..., {y,z}}, i.e. you get a list with the values {a+b, c+d, ..., y+z}, (because f[{a,b}] = a + b) I'll try to find out the final solution to your problem, which i remember it's simple...but check the above alternative way... Good Luck greetings G.Omikron Curry Taylor : > I have (for simplicity) something like this: > > f[x_, y_] := x+y; > > I want to use this function for a variety of parameters in a list: > > indices = {{a,b}, {c,d}, {e,f}, ..} > > so that I get > > {a+b, c+d, e+f, ..} > > Doing the intuitive thing (for me) > > f /@ indices > > results in > > {f[{a, b}], f[{c, d}], f[{e, f}], ..} > > but what I want is > > {f[a, b], f[c, d], f[e, f], ..} > > and that's not what I'm getting. I have tried using Flatten, pure > functions (Slot # and &), different Map functions, nesting at parameters > (like {1} and {2}), and other things but I just can't seem to get what I'm > after. Any help please? > > Thank you, > > Curry