MathGroup Archive 2003

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

Search the Archive

RE: nth differences

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39856] RE: [mg39852] nth differences
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sun, 9 Mar 2003 05:26:32 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Zachary,

list = {1, 2, 5, 7, 8, 9};

To obtain the first differences.

To obtain the first differences...

Drop[RotateLeft[list] - list, -1]
{1, 3, 2, 1, 1}

For the original list and all orders of differences...

NestList[Drop[RotateLeft[#] - #, -1] &, list, Length[list] - 1]
{{1, 2, 5, 7, 8, 9}, {1, 3, 2, 1, 1}, {2, -1, -1, 0}, {-3, 0, 1}, {3,
    1}, {-2}}

Usuable email addresses will more often get you a same day direct reply.
Otherwise you have to wait for the next day's postings.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


From: Zachary Turner [mailto:_NOzturnerSPAM_ at cyberonic.com]
To: mathgroup at smc.vnet.net

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





  • Prev by Date: RE: Help with FindRoot
  • Next by Date: Re: Symbols and Lists
  • Previous by thread: Re: RE: nth differences
  • Next by thread: Re: nth differences