MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: defined

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103396] Re: defined
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 20 Sep 2009 06:20:48 -0400 (EDT)

On 9/19/09 at 5:26 AM, murray at math.umass.edu (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

In[1]:= f[x_, y_, z_] := Sqrt[x^2 + y^2 + z^2]

In[2]:= a = {4, 3, 2};

In[3]:= f @@ a

Out[3]= Sqrt[29]

In[4]:= Apply[f, a]

Out[4]= Sqrt[29]



  • Prev by Date: Re: evaluate f[{x,y,z}] when f[x,y,z] defined
  • Next by Date: notebook formatting error
  • Previous by thread: Re: Re: Modifying Default Stylesheet?
  • Next by thread: notebook formatting error