GeometricMean
Computes the geometric mean of all elements in a container or in a sequence. The elements must be numbers.
Syntax
-
GeometricMean(X)-
Xis a vector, matrix, list, or set
-
-
GeometricMean(expr, var, a, b)-
expris an expression in one variablevar -
varis the variable inexpr -
ais the lower bound -
bis the upper bound
-
Description
Computing the mean of a container
If X is a non-empty container of numbers, then GeometricMean(X) is the geometric mean of all elements in X.
The following container types are supported:
-
vectors
-
the result is the mean of all components
-
-
matrices
-
the result is the mean of all entries
-
-
lists containing numbers
-
the result is the mean of all numbers
-
-
sets containing numbers
-
the result is the mean of all numbers
-
Typewise, the elements may be either real or complex, and the result is complex iff at least one of the elements is complex.
Computing the mean of a sequence
GeometricMean(expr, var, a, b) computes the geometric mean of the expression expr in one variable var as var takes all integer values from a to b (inclusively).
expr must return a number.
Examples
Computing the mean of a container
GeometricMean(❨5, 1, 2, 6, 3, 8, 4, 10, 2, 3❩)
3.57978853986
Computing the mean of a sequence
GeometricMean(n^2 + 3⋅n + 1, n, 1, 100)
1638.09050256