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: [mg46054] RE: [mg46046] help for time series basic operations
  • From: "David Park" <djmp at earthlink.net>
  • Date: Tue, 3 Feb 2004 22:19:07 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Paolo,

Use RotateLeft, subtract and Drop the last item. (% is the output from the
previously evaluated statement. If you put a number of statements together
in one cell it's safe to use.)

timeseries = Table[a[i], {i, 1, 10}]

RotateLeft[timeseries]
% - timeseries
Drop[%, -1]

Or wrapping it all in one statement...

Drop[RotateLeft[timeseries] - timeseries, -1]

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

From: paolo [mailto:tarpanelli at libero.it]
To: mathgroup at smc.vnet.net

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



  • Prev by Date: Re: How to plot...
  • Next by Date: Re: Graphics into MS Word
  • Previous by thread: Re: help for time series basic operations
  • Next by thread: Re: help for time series basic operations