MathGroup Archive 2004

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

Search the Archive

Re: expresion with variables from a list


Just use the Apply command.

list = {a, b, c};

f @@ list
f[a, b, c]

You could define f as a Function.

f = Function[{x, y, z}, x Sin[y - z]];

f @@ list
a Sin[b - c]

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 


From: wouter [mailto:woutertjuh at hotmail.com]
To: mathgroup at smc.vnet.net

hello, I have what is probably a very easy question. I want to define
an expression which has as as variables the elements of some
previously defined list. like for example, if you have lists:
list1 = {a, b}
and
list2 ={a, b, c}
then I want to define an expression that can evaluate both the
variables in list one and in list two that is:
f[list_] := ...,
which evaluates f[list1] = f[a_, b_] and f[list2] = f[x_,y_,z_].

this must be pausible in some way, not?

thanx




  • Prev by Date: MathML and WebMathematica
  • Next by Date: Re: expresion with variables from a list
  • Previous by thread: expresion with variables from a list
  • Next by thread: Re: expresion with variables from a list