Re: time serie -> sum inside a loop
- To: mathgroup at smc.vnet.net
- Subject: [mg46128] Re: [mg46100] time serie -> sum inside a loop
- From: "Sseziwa Mukasa,,(978) 536-2359" <mukasa at jeol.com>
- Date: Sat, 7 Feb 2004 04:02:12 -0500 (EST)
- References: <200402060915.EAA19235@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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
- References:
- time serie -> sum inside a loop
- From: "paolo" <tarpanelli@libero.it>
- time serie -> sum inside a loop