Re: help for time series basic operations
- To: mathgroup at smc.vnet.net
- Subject: [mg46057] Re: help for time series basic operations
- From: bobhanlon at aol.com (Bob Hanlon)
- Date: Tue, 3 Feb 2004 22:19:09 -0500 (EST)
- References: <bvpaq9$scp$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Here are some of the ways:
al[n_] := Table[ToExpression["a"<>ToString[k]],{k,n}];
a = al[5];
b = Rest[a-RotateRight[a]]
{a2-a1,a3-a2,a4-a3,a5-a4}
b==Drop[RotateLeft[a]-a,-1]
True
b==Rest[a]-Drop[a,-1]
True
b==ListCorrelate[{-1,1}, a]
True
b==ListConvolve[{1,-1}, a]
True
Bob Hanlon
In article <bvpaq9$scp$1 at smc.vnet.net>, "paolo" <tarpanelli at libero.it> wrote:
<< 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] >><BR><BR>