Re: evaluate f[{x,y,z}] when f[x,y,z] defined
- To: mathgroup at smc.vnet.net
- Subject: [mg103401] Re: evaluate f[{x,y,z}] when f[x,y,z] defined
- From: Erik Max Francis <max at alcyone.com>
- Date: Sun, 20 Sep 2009 06:22:22 -0400 (EDT)
- References: <h9283i$lo6$1@smc.vnet.net>
Murray Eisenberg wrote:
> I ought to know how to do this (simply) but don't, or at least don't
> recall how...
>
> Often I have a function of several variables defined, for example:
>
> f[x_, y_, z_] := Sqrt[x^2 + y^2 + z^2]
>
> And I have some list of numbers, e.g.:
>
> a = {4, 3, 2};
>
> How can I evaluate the following...
>
> f[a]
>
> ... without having to make a separate definition such as
>
> f[{x_, y_, z_}] := f[x, y,z]
Use @@:
In[1]:= f @@ {a, b, c}
Out[1]= f[a, b, c]
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
We are all here on earth to help others; what on earth the others are
here for I don't know. -- John Foster Hall