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