# Numerical Approximation of erfc I have a crazy output. I already tried the N[] function. All it does is condense the inputs. Any idea of how to have a numerical output from the code?

• Please provide actual code rather than an image of code. – Daniel Lichtblau Oct 3 '18 at 17:36

Clear["Global*"]

dist = NormalDistribution[a, b];

\$Assumptions = DistributionParameterAssumptions[dist]

(* a ∈ Reals && b > 0 *)

cdf[q_] = CDF[dist, q];


If I have read your expression properly, it can be written more compactly as

expr1 = (4*(cdf - cdf) + 6*(cdf - cdf) +
8*(cdf - cdf) + 10*(cdf - cdf) +
12*(cdf - cdf))/(cdf - cdf) // FullSimplify;


And even more so as

expr2 = Total[
2 (# + 1)*(cdf[#] - cdf[# - 1]) & /@ Range]/(cdf - cdf) //
FullSimplify

(* (2 (-6 Erf[(-5 + a)/(Sqrt b)] + Erf[(-4 + a)/(Sqrt b)] +
Erf[(-3 + a)/(Sqrt b)] + Erf[(-2 + a)/(Sqrt b)] +
Erf[(-1 + a)/(Sqrt b)] + 2 Erf[a/(Sqrt b)]))/(-1 +
Erf[a/(Sqrt b)] + Erfc[(-5 + a)/(Sqrt b)]) *)


Verifying that expr1 and expr2 are identical

expr1 === expr2

(* True *)


a = (1/2*Erfc[1/Sqrt]*x);
`