Re: Applying a list of 2D paramters to a mathematica function
- To: mathgroup at smc.vnet.net
- Subject: [mg68087] Re: Applying a list of 2D paramters to a mathematica function
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Sat, 22 Jul 2006 06:24:10 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 7/21/06 at 5:37 AM, curry at 192.168.0.101 (Curry Taylor) wrote:
>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], ..}
do the following:
In[1]:=
indices={{a,b},{c,d},{e,f}};
In[2]:=
g@@@indices
Out[2]=
{g[a, b], g[c, d], g[e, f]}
Note, I used g as the function name since I am sure will not like what Mathematica returns when you use f as the function name and the name of a parameter to be supplied to the function.
--
To reply via email subtract one hundred and four