Skip to content

Instantly share code, notes, and snippets.

@azarnyx
Last active July 28, 2019 17:14
Show Gist options
  • Save azarnyx/a2b44f74ecb537d62152ccff17f3e038 to your computer and use it in GitHub Desktop.
Save azarnyx/a2b44f74ecb537d62152ccff17f3e038 to your computer and use it in GitHub Desktop.
import numpy as np
from scipy.optimize import minimize
import pylab as plt
import itertools
num_sides1 = 6
num_sides2 = 10
mean1 = 4.5
mean2 = mean1
def f(x):
return - x*np.log(x)
def sum_form(p):
s = 0
for pi in p:
# as we will to minimize, add minus
s += - f(pi)
return s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment