MathGroup Archive 2007

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

Search the Archive

Re: Evaluation Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76499] Re: [mg76448] Evaluation Question
  • From: "Lev Bishop" <lev.bishop at gmail.com>
  • Date: Wed, 23 May 2007 05:21:03 -0400 (EDT)
  • References: <200705220656.CAA20144@smc.vnet.net>

On 5/22/07, hoffmannick <hoffmannick at gmail.com> wrote:
> Can anyone help me solve the following problem?
>
> I have a function of 3 variables, let's say
> f[a_, b_, c_] = a + b + c
>
> Now I need to evaluate the function at some given points.  To evaluate
> at a single point I would do
> f[0,0,1]
>
> For the point (0,0,1)
>
> Now here is the main question.
> I need to evaluate this function at the points (0,0,0) through (1,1,1)

In[9]:= f@@@Tuples[{0,1},3]
Out[9]= {f[0,0,0],f[0,0,1],f[0,1,0],f[0,1,1],f[1,0,0],f[1,0,1],f[1,1,0],f[1,1,1]}

or to do all your functions at once:
In[35]:= funcs={f,g,h};
res=Outer[Apply,funcs,Tuples[{0,1},3],1];
Grid@Transpose@res
Out[37]= f[0,0,0]	g[0,0,0]	h[0,0,0]
f[0,0,1]	g[0,0,1]	h[0,0,1]
f[0,1,0]	g[0,1,0]	h[0,1,0]
f[0,1,1]	g[0,1,1]	h[0,1,1]
f[1,0,0]	g[1,0,0]	h[1,0,0]
f[1,0,1]	g[1,0,1]	h[1,0,1]
f[1,1,0]	g[1,1,0]	h[1,1,0]
f[1,1,1]	g[1,1,1]	h[1,1,1]


  • Prev by Date: Re: Re: Simplify (-1)^((-1)^n)
  • Next by Date: Re: Dialogs and inheritance
  • Previous by thread: Evaluation Question
  • Next by thread: Re: Evaluation Question