MathGroup Archive 1996

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

Search the Archive

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

  • Subject: [mg2935] Re: [mg2924] Question: Applying a list of funcs to a list of expressions
  • From: me at talmanl.mscd.edu (Lou Talman)
  • Date: 13 Jan 1996 05:30:50 -0600
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: mj at wri.com

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






  • Prev by Date: Re: Unix Kernel with Windows frontend?
  • Next by Date: Re: Mathematica does not know where are my files. Help!!!
  • 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