|
|
|
|
|
|
|
|
CTK Exchange
Steve

guest
|
Jun-08-09, 02:46 PM (EST) |
|
"Calculating Averages"
|
Is it possible to calculate the average of a series of numbers without knowing all of the values in the series? An algorithm would be useful in computer programs where storage may be limited or where a running average over a long time period may be desired. If I have an average A based on n samples, can I use only A and n to calculate the new average? |
|
Alert | IP |
Printer-friendly page |
Reply |
Reply With Quote | Top |
|
|
alexb
Charter Member
2388 posts |
Jun-08-09, 02:54 PM (EST) |
 |
1. "RE: Calculating Averages"
In response to message #0
|
So assume an average of some n numbers is A and the average of a different group of m numbers is B. If I understand correctly, you ask whether it is possible to obtain the average of the combined group of n+m numbers. This average is (An + Bm) / (n + m) and could be calculated recursively via An+1 = (nAn + an+1) / (n + 1) for a sequence a1, a2, ... and A1 = a1. You must be aware of the accumulation of the run-off errors, of course. |
|
Alert | IP |
Printer-friendly page |
Reply |
Reply With Quote | Top |
|
|

You may be curious to have a look at the old CTK Exchange archive. Please do not post there.
Copyright © 1996-2018 Alexander Bogomolny
|
|