public void CalculateValues(Binomial_RV xB_rv) { int n = (int)xB_rv.GetSubExressions()[0][0].GetValue(); double p = (double)xB_rv.GetSubExressions()[0][1].GetValue(); int x = (int)xB_rv.GetSubExressions()[0][2].GetValue(); // Formula: P(X = j) = nCj * p ^ j * q ^ (n - j), // - nCr = n! / ((n-r)! * r!). Value = (Factorial(n) / (Factorial(n - x) * Factorial(x))) * Math.Pow(p, x) * Math.Pow((1 - p), (n - x)); }