MathGroup Archive 2004

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

Search the Archive

Re: time serie -> sum inside a loop


On Feb 6, 2004, at 4:15 AM, paolo wrote:

> Given a time serie
> a:= {a[[1]],a[[2]],a[[3]],...,a[[n]]}
>
> how can i solve this loop with mathematica?
>
> -------------
> Y[[i]]:=Sum_(for k=1 to i) [a[[k]]-mu]
> -------------
>
> where mu is the mean of time serie a.
>
> thanks
>
> Paolo Tarpanelli

Your notation is a bit strange, there is a difference between = (Set) 
and := (SetDelayed) and its hard to tell where you wish to use = and 
:=.

Taking a guess at what you mean to do, with a little manipulation, and 
using proper Mathematica notation we can see that

Y[i_]:=(1-i/n) Sum[a[[k]],{k,i}]-i/n Sum[a[[k]],{k,i+1,n}]

presumably n is defined somewhere or you can replace it with Length[a].
You should probably define a as

a={values} not a:={values}.

Regards,

Ssezi


  • Prev by Date: Plotting a 7 vertex graph in which every vertex has degree 4
  • Next by Date: RE: derivation of a picewise defined function
  • Previous by thread: time serie -> sum inside a loop
  • Next by thread: Re: time serie -> sum inside a loop