powered by
The elementwise entropy function, \(-xlog(x)\).
entr(x)
An Expression representing the entropy of the input.
An Expression, vector, or matrix.
x <- Variable(5) obj <- Maximize(sum(entr(x))) prob <- Problem(obj, list(sum(x) == 1)) result <- solve(prob) result$getValue(x)
Run the code above in your browser using DataLab