Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: help for time series basic operations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46081] Re: [mg46046] help for time series basic operations
  • From: Hugh Walker <hwalker at gvtc.com>
  • Date: Thu, 5 Feb 2004 04:03:00 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On Tuesday, February 3, 2004, at 05:20 PM, paolo wrote:

> I am a quantitative analyst and for the first time i am using 
> Mathematica. So, I
> am sorry if my question seem "very easy (almost stupid)" but i need 
> some helps
> to begin to understand Mathematica
>
> I have a time series
> a:=[a_1,a_2,a_3,a_4,...a_n]
> how can i do to subtract each element for the previous one?:
>
> b:=[a_2 - a_1, a_3 - a_2, a_4 - a_3,.....,a_n - a_n-1]
>
> Thanks
>
> Paolo Tarpanelli

Paolo:

Here is one way. Let lst be the list in question, then the "difference 
list" is

lstSub = Drop[(RotateLeft[lst] - lst), -1]

Cheers,

==========
Hugh Walker
Gnarly Oaks


  • Prev by Date: Re: help for time series basic operations
  • Next by Date: Re: help for time series basic operations
  • Previous by thread: Re: help for time series basic operations
  • Next by thread: Nested optimization teaser