Re: nth differences
- To: mathgroup at smc.vnet.net
- Subject: [mg39870] Re: [mg39852] nth differences
- From: Dr Bob <drbob at bigfoot.com>
- Date: Sun, 9 Mar 2003 05:29:13 -0500 (EST)
- References: <200303080752.CAA23708@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
differences[a_List] := NestList[Drop[RotateLeft@# - #, -1] &, a,
Length@a - 1]
differences@{1, 2, 5, 7, 8, 9}
Bobby
On Sat, 8 Mar 2003 02:52:13 -0500 (EST), Zachary Turner
<_NOzturnerSPAM_ at cyberonic.com> wrote:
> Say I have a list of k integers and I want to produce a list containing
> the
> first differences? For example, given {1, 2, 5, 7, 8, 9} the first
> differences are {1, 3, 2, 1, 1}, and the second differences are {2, -1, -
> 1,
> 0}, the third are {-3, 0, 1}, etc
>
>
>
>
--
majort at cox-internet.com
Bobby R. Treat
- References:
- nth differences
- From: "Zachary Turner" <_NOzturnerSPAM_@cyberonic.com>
- nth differences