math - Approximation of sum/average of last n terms in a series -
assume have series t_1, t_2,..., t_n,..., , number coming in. want calculate approximate of sum/average of last t numbers, without storing t numbers. thing stored previous sum/average. appropriate function?
e.g.
s_1 = t_1 s_2 = f(t_2, s_1) s_3 = f(t_3, s_2) the possible function may s_2 = t_2 + s_1 * (e ^ -1), optimal solution?
note: window size fixed. there no exact solution, approximation, since number out of window not known.
note 2: discussion. know answer now. trivial, fault not thinking well. delete question later. way, answer is, should assume number out of window average. under assumption, new sum
(old average)*(t-1) + new number and new average
((old average)*(t-1)+(new number))/t
first of all, realistically question mathematics stack exchange
but anyway, since dont mention programming language, ill go c# (with array). lets call series 'myseries':
double average=0; (int = 0; < myseries.length; i++) average+=myseries[i]/(i+1); messagebox.show("here average dawg:" + average.tostring());
Comments
Post a Comment