Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

harmonic_mean

Harmonic Mean


Description

The harmonic mean, ≤ft(\frac{1}{n} ∑_{i=1}^n x_i^{-1}\right)^{-1}. For a matrix, the function is applied over all entries.

Usage

harmonic_mean(x)

Arguments

x

An Expression, vector, or matrix.

Value

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)

CVXR

Disciplined Convex Optimization

v1.0-10
Apache License 2.0 | file LICENSE
Authors
Anqi Fu [aut, cre], Balasubramanian Narasimhan [aut], David W Kang [aut], Steven Diamond [aut], John Miller [aut], Stephen Boyd [ctb], Paul Kunsberg Rosenfield [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.