MathGroup Archive 2004

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

Search the Archive

Re: help for time series basic operations


Hi,
Here is one way,

Out[16]= {a1, a2, a3, a4, a5, a6, a7}

In[17]:= Table[a[[i+1]]-a[[i]], {i,1,Length[a]-1, 1}]

Out[17]= {-a1 + a2, -a2 + a3, -a3 + a4, -a4 + a5, -a5 + a6, -a6 + a7}

NB. Avoid using the underscore character on the right hand side for naming
of variables. The underscore character has special meaning in Mathematica.


Ciao

On Tue, 3 Feb 2004, 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
>


  • Prev by Date: Re: how to run a shell command in mathematica?
  • Next by Date: RE: help for time series basic operations
  • Previous by thread: help for time series basic operations
  • Next by thread: Re: help for time series basic operations