Re: expresion with variables from a list
- To: mathgroup at smc.vnet.net
- Subject: [mg50480] Re: [mg50472] expresion with variables from a list
- From: "David Park" <djmp at earthlink.net>
- Date: Mon, 6 Sep 2004 03:59:40 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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