Algosim documentation: GeometricMean

GeometricMean

Computes the geometric mean of all elements in a container or in a sequence. The elements must be numbers.

Syntax

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:

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

See also