Averaging allows you to find the general trends,understand the potential costs, based on the previous experience of spending or budget to rely on the trip. Finding the arithmetic mean value is necessary in science, business and everyday life.
How to calculate the desired value?
To find the arithmetic mean valueyou need to add up all the components and the amount received divided by the number of component sums. This operation can be represented by the formula: mean value = (a (1) + a (2) + ... + a (n-1) + a (n)) / n, where n - number of the last term of the sum in the order (number of terms) .
To find the middle term valuearithmetic progression must be added to the first term of the sequence from the last and divide in half the amount received. Record expression mathematical symbols: Mean progression = (a (1) + a (n)) / 2.
Formulas are for arithmetic progressiondesigned by the great German mathematician Gauss. He is a child found a way to calculate the sum of the whole progression with step 1 (series of natural numbers) without a separate addition of its members. To this end, the young Karl folded first term progression from the last and multiplied the sum by half the number of terms of the sequence.
The problem of finding the arithmetic meanvalue is often found in programming. For its simple solution is necessary to use a stepping cycle (with the progress in the unit, called increments). In most programming languages (C #, Java, Pascal, PHP), this cycle is called for.
Before entering the loop, declare the variables S (sum) andsred (arithmetic mean). Give them a value of zero (this process is called initialization). Enter the cycle. To sum S add all the new terms of the sequence. Thus is formed a complete arithmetic sum.
After the cycle, follow the action: sred = S / n. Note the type of the variable S must be an integer (with integral terms) and sred - real as a fractional number can happen as a result of the division. So you get the arithmetic mean value of the programming.