'Evaluate the Knuth function
Parameters
dx : float
Width of bins
Returns
F : float
evaluation of the negative Knuth likelihood function:
smaller values indicate a better fit.'

def eval(self, M):

    M = int(M)
    if (M <= 0):
        return np.inf
    bins = self.bins(M)
    (nk, bins) = np.histogram(self.data, bins)
    return (- (((((self.n * np.log(M)) + self.gammaln((0.5 * M))) - (M * self.gammaln(0.5))) - self.gammaln((self.n + (0.5 * M)))) + np.sum(self.gammaln((nk + 0.5)))))
