MathGroup Archive 2006

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

Search the Archive

Re: To apply a function to a List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65610] Re: To apply a function to a List
  • From: "Borut Levart" <BoLe79 at gmail.com>
  • Date: Tue, 11 Apr 2006 04:04:17 -0400 (EDT)
  • References: <e1cusv$enp$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hej Francisco,

This tackles the usage of Mathematica's powerful constructs like: Map,
Apply, Thread. See the beginning sections in the Mathematica Book, it's
a fun read!

For your example, you should "map" over the list, and the iteration you
specified with Table, will be handled automatically:

Map[f,list]

or in "short notation":

f /@ list

For example:

f = Cos[# - Pi/2]&
list = {0, Pi/2, Pi, 10 Pi};

f /@ list

or directly: Cos[# - Pi/2]& /@ list

and so on, there are practically no limits to the combinations!! It's
so much fun, you must admit that.

Bye,
Borut Levart
Slovenia


  • Prev by Date: Flatten and BlockProcessing
  • Next by Date: Re: To apply a function to a List
  • Previous by thread: Re: To apply a function to a List
  • Next by thread: Re: To apply a function to a List