Re: Applying a list of 2D paramters to a mathematica function
- To: mathgroup at smc.vnet.net
- Subject: [mg68062] Re: [mg68041] Applying a list of 2D paramters to a mathematica function
- From: Adriano Pascoletti <pascolet at dimi.uniud.it>
- Date: Fri, 21 Jul 2006 17:35:59 -0400 (EDT)
- References: <200607210937.FAA06876@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Curry,
look at Apply in the help browser.
f @@@ indices
gives
{f[a, b], f[c, d], f[e, f]}
Adriano Pascoletti
On 21 lug 2006, at 11:37, 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], ..}
>
> 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
>
- References:
- Applying a list of 2D paramters to a mathematica function
- From: Curry Taylor <curry@192.168.0.101>
- Applying a list of 2D paramters to a mathematica function