Re: pick out an element from list
- To: mathgroup at smc.vnet.net
- Subject: [mg98091] Re: pick out an element from list
- From: Raffy <raffy at mac.com>
- Date: Sun, 29 Mar 2009 03:23:21 -0500 (EST)
- References: <gqkup8$458$1@smc.vnet.net>
On Mar 28, 3:39=C2 am, bahadir <bahadirgurbu... at hotmail.com> wrote:
> i have a list with n element.i want to pick out an element from the list,=
and to deduct the element from all the other residual elements. This proce=
ss is the first step. i must apply all elements of the list, invariably. Na=
mely, in conclusion, i will obtain n list with n-1 elements. now, i will tr=
y to explain as numerically. let element number of the list be 2500. and i =
am picking out the first element of the list. and i'm deducting the first e=
lement from the residual elements of the list. and now, i have a list with =
2499 elements.after that, i'm passing the second element, and i'm applying =
the same processes. =C4=B1 can't do this, can anyone help me???
I'm not sure if I follow but:
v = RandomReal[{0, 1}, 10];
First@NestWhile[Rest[#] - First[#] &, v, Length[#] > 1 &]
Which is same thing as:
Take[v, -2].{-1, 1}