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: [mg65609] Re: [mg65597] To apply a function to a List
  • From: Pratik Desai <pratikd at wolfram.com>
  • Date: Tue, 11 Apr 2006 04:04:15 -0400 (EDT)
  • References: <200604100631.CAA14845@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Francisco Javier wrote:
> Dear all,
>
> Let f, l be a function and a list respectively. How can we do
>
> Table[f[list[[n]]],{n,1, Length[list]}]
>
> in another way?
>
> Thanks.
>
>   
Perhaps using Map

In[5]:=
Clear[list]
list=Table[Random[],{10}]
Table[f[list[[n]]],{n,1,Length[list]}]
Map[f,list]


Out[6]=
{0.954944,0.449846,0.831544,0.485511,0.371568,0.588545,0.725658,0.19598,0.\
583527,0.814898}

Out[7]=
{f[0.954944],f[0.449846],f[0.831544],f[0.485511],f[0.371568],f[0.588545],f[0.\
725658],f[0.19598],f[0.583527],f[0.814898]}

Out[8]=
{f[0.954944],f[0.449846],f[0.831544],f[0.485511],f[0.371568],f[0.588545],f[0.\
725658],f[0.19598],f[0.583527],f[0.814898]}

Hope this helps

-- 
Pratik Desai
Wolfram Research, Inc
Technical Support 


  • Prev by Date: Re: Net/Link: TimeContrained call to DLL
  • Next by Date: ViewPoint selector
  • Previous by thread: Re: To apply a function to a List
  • Next by thread: Re: To apply a function to a List