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
- References:
- To apply a function to a List
- From: Francisco Javier <pacoga@ctv.es>
- To apply a function to a List