Question: Applying a list of funcs to a list of expressions
- Subject: [mg2924] Question: Applying a list of funcs to a list of expressions
- From: groskyd at gv.ssi1.com (David Rosky)
- Date: 11 Jan 1996 09:46:18 -0600
- Approved: usenet@wri.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: Silicon Systems, Inc.
- Sender: mj at wri.com
I would like to specify a list of functions such as:
funcs = {f1, f2, f3}
and a list of values to which the functions will be
applied:
vals = {val1, val2, val3}
I would then like to apply to each function to each corresponding value
respectively to obtain the following list:
DesiredOutputList = {f1[val1], f2[val2], f3[val3]}
I can do this explicitly by defining the functions in terms of the
explicit elements of the list such as f1[x_] := x[[1]]^2 and so on
for the other functions, but I was wondering if there is a built-in
way to apply a list of functions respectively to the elements of a list
of values which would be simpler and more efficient. I looked through
the Mathematica book and nothing obvious popped out at me, but is seems
like such a simple concept that it must be there somewhere.
Thanks in advance,
--David
------------------ groskyd at gv.ssi1.com ------------------