MathGroup Archive 2011

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

Search the Archive

Re: Apply or Map on some parts of lists - help


On Jan 16, 9:54 pm, Armand Tamzarian <mike.honeychu... at gmail.com>
wrote:
> On Jan 15, 8:46 pm, dragec <culino... at gmail.com> wrote:
>
>
>
> > Dear,
> > I have
>
> > List like:
>
> > { {{TITLE1},{{x11,y11},{x12,y12},{x13,y13},{x14,y14}}},
> >   {{TITLE1},{{x21,y21},{x22,y22},{x23,y23},{x24,y24}}},
> >   {{TITLE1},{{x31,y31},{x32,y32},{x33,y33},{x34,y34}}}
>
> > }
>
> > So, I would like to apply some function (eg. #/3.6&) to all y's.
> > Is there any elegant way to do this.
> > I Know that you know how to do this. :)
>
> > THX
>
> list=your list above
>
> Map[#[[2]]/3.6 &, list[[All, 2 ;;]], {3}]
>
> Mike

Looks like everyone interpreted your question has you wanting your
entire list as output rather than the y's. In that case do this:

list[[All, 2 ;; -1, All, 2]] = Map[f, list[[All, 2 ;; -1, All, 2]],
{3}];

If your real list is large it will be much faster than using Replace.

Mike


  • Prev by Date: Re: Making a table with unlinked sliders
  • Next by Date: Re: How to force numeric output
  • Previous by thread: Re: Apply or Map on some parts of lists - help
  • Next by thread: Re: Apply or Map on some parts of lists - help