harmonic_mean function

Harmonic Mean

Harmonic Mean

The harmonic mean, (1ni=1nxi1)1\left(\frac{1}{n} \sum_{i=1}^n x_i^{-1}\right)^{-1}. For a matrix, the function is applied over all entries. methods

harmonic_mean(x)

Arguments

  • x: An Expression , vector, or matrix.

Returns

An Expression representing the harmonic mean of the input.

Examples

x <- Variable() prob <- Problem(Maximize(harmonic_mean(x)), list(x >= 0, x <= 5)) result <- solve(prob) result$value result$getValue(x)
  • Maintainer: Anqi Fu
  • License: Apache License 2.0 | file LICENSE
  • Last published: 2024-11-07