fix Var(x) and define erf function