MathGroup Archive 2006

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

Search the Archive

Re: To apply a function to a List


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