Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scripting_function


Panel
titleDescription

Calculates the geometric mean. Geometric mean is a type of average which indicates a typical value in a set of numbers by using the product of values in the set and then taking the nth root, where n is the number of values in the set. This is different than an arithmetic mean, which calculates an average based off the sum of the numbers, and divides it by n number of values. Geometric means can only be positive numbers.

Returns NaN (Not a Number) if passed an empty sequence.

Client permissions restrictions


Panel
titleSyntax

system.math.geometricMean(values)

  • Parameters

List[Float] values - A sequence of numerical values. Accepts both integers and floats. The sequence may not contain None type values. However, passing a None type object instead of a sequence of numerical values will return NaN.

  • Returns

Float - The geometric mean, or NaN if the input was empty or null. Because this uses logs to compute the geometric mean, will return NaN if any entries are negative.

  • Scope

Gateway, Vision Client, Perspective Session

Panel
titleCode Example
Code Block
languagepy
titleCode Snippet - Calculating Geometric Mean
# Create a List of values.
values = [3.5, 5.6, 7.8, 7.4, 3.8]

# Prints the resulting value. 
print system.math.geometricMean(values)
Panel
titleKeywords

system math geometricMean, math.geometricMean