Mean
Mean
Mean[ list ] calculates the mean of the numbers in a list.
Usages
Mean[ list ]
Mean[ list ] calculates the sum of the numbers in list, divided by the number of elements. The elements must be numbers or fractions. In a script, wrap the command in Simplify.
| Example | in | out |
|---|---|---|
The mean of 1, 2 and 3. |
Simplify[ Mean[ {1, 2, 3} ] ] |
2 |
| The result is a fraction if the mean is not an integer. | Simplify[ Mean[ {1, 2} ] ] |
3/2 |
| The mean of two fractions. | Simplify[ Mean[ {1/2, 1/3} ] ] |
5/12 |
| Decimal numbers also give a fraction as the result. | Simplify[ Mean[ {1.5, 2} ] ] |
7/4 |
Details
- Single value:
Mean[ {5} ]andMean[ 5 ]both give5. - Without
Simplify, the command is not calculated: in a script,Mean[ {1, 2, 3} ]staysMean[ {1, 2, 3} ].
| Invalid input | Result |
|---|---|
Simplify[ Mean[ {x, 2} ] ] |
Not calculated: the elements must be numbers or fractions. The result is Mean[x, 2]. |
Simplify[ Mean[ {Sqrt[2], 2} ] ] |
Not calculated: roots and other expressions are not supported. The result is Mean[Sqrt[2], 2]. |