def dist(value): return switch( ge(value, 0) & gt(alpha, 0) & gt(beta, 0) & ge(n, value), gammaln(alpha + beta) - gammaln(alpha) - gammaln(beta) + gammaln(n + 1) - gammaln(value + 1) - gammaln(n - value + 1) + gammaln(alpha + value) + gammaln(n + beta - value) - gammaln(beta + alpha + n), -inf)
def dist(value): return switch( gt(lam,0), #factorial not implemented yet, so value * log(lam) - gammaln(value + 1) - lam, -inf)
def dist(value): return switch(ge(value , 0) & gt(alpha , 0) & gt(beta , 0), -gammaln(alpha) + alpha*log(beta) - beta*value + switch(alpha != 1.0, (alpha - 1.0)*log(value), 0), -inf)
def dist(value): return switch(gt(lam , 0) & gt(nu , 0), gammaln((nu+1.0)/2.0) + .5 * log(lam / (nu * pi)) - gammaln(nu/2.0) - (nu+1.0)/2.0 * log(1.0 + lam *(value - mu)**2/nu), -inf)
def dist(value): return switch (ge(value , 0) & gt(alpha , 0) & gt(beta , 0) & ge(n , value), gammaln(alpha+beta) - gammaln(alpha) - gammaln(beta)+ gammaln(n+1)- gammaln(value+1)- gammaln(n-value +1) + gammaln(alpha+value)+ gammaln(n+beta-value)- gammaln(beta+alpha+n), -inf)
def dist(value): return switch(ge(value , 0) & le(value , 1) & gt(alpha , 0) & gt(beta , 0), gammaln(alpha+beta) - gammaln(alpha) - gammaln(beta) + (alpha- 1)*log(value) + (beta-1)*log(1-value), -inf)
def factln(n): return gammaln(n + 1)
def Gamma(value, alpha, beta): return switch((value >= 0) & (alpha > 0) & (beta > 0), -gammaln(alpha) + alpha*log(beta) - beta*value + switch(alpha != 1.0, (alpha - 1.0)*log(value), 0), -inf)
def T(value, mu, lam, nu): return switch((lam > 0) & (nu > 0), gammaln((nu+1.0)/2.0) + .5 * log(lam / (nu * pi)) - gammaln(nu/2.0) - (nu+1.0)/2.0 * log(1.0 + lam *(value - mu)**2/nu), -inf)
def BetaBin(value, alpha, beta, n): return switch ((value >= 0) & (alpha > 0) & (beta > 0) & (n >= value), gammaln(alpha+beta) - gammaln(alpha) - gammaln(beta)+ gammaln(n+1)- gammaln(value+1)- gammaln(n-value +1) + gammaln(alpha+value)+ gammaln(n+beta-value)- gammaln(beta+alpha+n), -inf)
def Beta(value, alpha, beta): return switch((value >= 0) & (value <= 1) & (alpha > 0) & (beta > 0), gammaln(alpha+beta) - gammaln(alpha) - gammaln(beta) + (alpha- 1)*log(value) + (beta-1)*log(1-value), -inf)