Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

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

Search the Archive

Re: Question: Applying a list of funcs to a list of expressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg2935] Re: [mg2924] Question: Applying a list of funcs to a list of expressions
  • From: Lou Talman <me at talmanl.mscd.edu>
  • Date: Sat, 13 Jan 1996 03:19:56 -0500

The "obsolete" Compose operator, used in conjunction with  
Inner does the trick--in spite of the error messages:

In[1]:=
  F = {f1, f2, f3}
Out[1]=
  {f1, f2, f3}
In[2]:=
  X = {x1, x2, x3}
Out[2]=
{x1, x2, x3}
In[3]:=
Inner[Compose, F, X, List]
Compose::obsfn: 

   Compose is an obsolete function, superseded by 

    Composition.
Compose::obsfn: 

   Compose is an obsolete function, superseded by 

    Composition.
Compose::obsfn: 

   Compose is an obsolete function, superseded by 

    Composition.
General::stop: 

   Further output of Compose::obsfn
     will be suppressed during this calculation.
Out[3]=
  {f1[x1], f2[x2], f3[x3]}

--Lou Talman

Begin forwarded message:

>From: groskyd at gv.ssi1.com (David Rosky)
>Subject: [mg2924] Question: Applying a list of funcs to a  
list of expressions
>Organization: Silicon Systems, Inc.


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 ------------------





==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: Unix Kernel with Windows frontend?
  • Next by Date: Re: Unix Kernel with Windows frontend?
  • Previous by thread: Re: Question: Applying a list of funcs to a list of expressions
  • Next by thread: Re: Question: Applying a list of funcs to a list of expressions