added probabilityFormula function