MathGroup Archive 2004

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

Search the Archive

RE: help for time series basic operations


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