Re: Apply function to parts of a list
- To: mathgroup at smc.vnet.net
 - Subject: [mg86288] Re: Apply function to parts of a list
 - From: Bill Rowe <readnewsciv at sbcglobal.net>
 - Date: Fri, 7 Mar 2008 02:32:25 -0500 (EST)
 
On 3/6/08 at 2:59 AM, guerom00 at gmail.com (guerom00) wrote:
>Very often, I find myself having datas to plot of this form :
>data={{x1,y1},{x2,y2},{x3,y3}...{xn,yn}}
>So, very conventional : a list of abscissa and ordinate. Now, let's
>say I want to multiply by 2 all my ascissa. Right now, I write :
>MapAt[2*#&,data,Table[{i,1},{i,1,Length[data]}]]
>It's OK but I isn't there another way to achieve this as I find this
>rather "involved" for such a simple thing ?
There are a variety of other methods such as:
data /.{{a_, b_} :> {2 a, b}}
data.{{2, 0}, {0, 1}}
{2 First@#, Last@#} & /@ data
--
To reply via email subtract one hundred and four