double pdf(double x) { final b = math.beta(alpha, beta); return math.pow(x, alpha - 1) * math.pow(1 - x, beta - 1) / b; }