Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the numerically best way to calculate the average

Tags:

what's the best way to calculate the average? With this question I want to know which algorithm for calculating the average is the best in a numerical sense. It should have the least rounding errors, should not be sensitive to over- or underflows and so on.

Thank you.


Additional information: incremental approaches preferred since the number of values may not fit into RAM (several parallel calculations on files larger than 4 GB).

like image 703
Tobias Langner Avatar asked Sep 26 '11 08:09

Tobias Langner


People also ask

How do you calculate numerical average?

Average equals the sum of a set of numbers divided by the count which is the number of the values being added. For example, say you want the average of 13, 54, 88, 27 and 104. Find the sum of the numbers: 13 + 54 + 88+ 27 + 104 = 286. There are five numbers in our data set, so divide 286 by 5 to get 57.2.

What are the 3 ways to calculate average?

There are three main types of average: mean, median and mode. Each of these techniques works slightly differently and often results in slightly different typical values. The mean is the most commonly used average. To get the mean value, you add up all the values and divide this total by the number of values.

Which is one of the simplest methods to calculate average?

Given a list of numbers, it is easy to determine the arithmetic mean, or average. The average is simply the sum of the numbers in a given problem, divided by the number of numbers added together. For example, if four number are added together their sum is divided by four to find the average or arithmetic mean.

How do you figure out the average between two numbers?

It is calculated by adding up all the numbers, then dividing the total by the count of numbers. In other words, it is the sum divided by the count. Average of two numbers is given by the sum of the two numbers divided by two.


1 Answers

If you want an O(N) algorithm, look at Kahan summation.

like image 129
MSalters Avatar answered Sep 19 '22 14:09

MSalters