MathGroup Archive 2007

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

Search the Archive

Re: buliding on functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79048] Re: buliding on functions
  • From: Peter Pein <petsie at dordos.net>
  • Date: Tue, 17 Jul 2007 03:18:19 -0400 (EDT)
  • References: <f7f2pb$o7k$1@smc.vnet.net>

JGBoone at gmail.com schrieb:
> so i have a group functions that i want to work on three list at the
> same time. everytime i've tryed to get mathematica to run through all
> at the smae time. i find out the functions only acted on one list. any
> ideas?
> 
> 

Hello,

a short example of the code that does not what it is expected to do
would help us to help you.

 Well, I'll guess what you want:

You've got for example three lists and two functions:

lsts = Partition[Range[12], 4];
funs = {f, g};

and you are looking for the function that applies each function to each
list:

Outer[#1[#2] & , funs, lsts, 1]
-->
{{f[{1, 2, 3, 4}], f[{5, 6, 7, 8}], f[{9, 10, 11, 12}]},
  {g[{1, 2, 3, 4}], g[{5, 6, 7, 8}], g[{9, 10, 11, 12}]}}

or

(#1 /@ lsts & ) /@ funs

which is short for Map[Map[#1,lsts]&,funs]

or do you want to apply f ang g to the elements of the lists?

Outer[#1[#2] & , funs, lsts, 2]

gives

{{{f[1], f[2], f[3], f[4]}, {f[5], f[6], f[7], f[8]},
   {f[9], f[10], f[11], f[12]}}, {{g[1], g[2], g[3], g[4]},
   {g[5], g[6], g[7], g[8]}, {g[9], g[10], g[11], g[12]}}}

and so does

Map[Map[#1,lsts,{2}]&,funs]


If this is not what you want, please specify.

Regards,
Peter


  • Prev by Date: Re: Copying cells in simple text form?
  • Next by Date: RE: UnTableForming a TableFormed Table?
  • Previous by thread: Re: buliding on functions
  • Next by thread: Re: buliding on functions