       Re: time serie -> sum inside a loop

• To: mathgroup at smc.vnet.net
• Subject: [mg46131] Re: time serie -> sum inside a loop
• From: drbob at bigfoot.com (Bobby R. Treat)
• Date: Sat, 7 Feb 2004 04:02:16 -0500 (EST)
• References: <bvvneh\$j53\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```I'm not clear what "solve" means here; there are no conditions
mentioned. I'm also not sure if you mean mu to be an unknown, or
calculated from some part of the data. But here goes (outputs
suppressed):

Clear@y
y[i_] := Sum[a[k] - mu, {k, i}]
n = 8;
Clear@a
b = Array[a, n]
mu =.;
y /@ Range@8
mu = Tr@b/n;
y /@ Range@8

This version might be instructive too:

Clear@y
y[i_] := Expand[Sum[a[k] - mu, {k, i}]]
mu = Tr@b/n;
y /@ Range@8

In either case, Sum[a[k]-mu,{k,i}] could be replaced by
Sum[a[k],{k,i}]-i*mu.

Bobby

"paolo" <tarpanelli at libero.it> wrote in message news:<bvvneh\$j53\$1 at smc.vnet.net>...
> Given a time serie
> a:= {a[],a[],a[],...,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

```

• Prev by Date: RE: random numbers?
• Next by Date: RE: derivation of a picewise defined function
• Previous by thread: Re: time serie -> sum inside a loop
• Next by thread: Re: time serie -> sum inside a loop