# Increase in area under the curve as standard deviation decreases? Not what I expect

Suppose I have a PDF with mean a and standard deviation b defined as below. As the value of k increases, a should decrease, while b should also decrease. This should cause a decrease in the output, but for some reason, there is an increase. Even when I set the value of b constant, and simply let a decrease, the output increases, which should not happen. Any thoughts?

a=1/2Erfc[k/Sqrt] * x
k=0.2
b= -q Log[2, q] - (1 - q) Log[2, 1 - q]
q=a/x
x=7

N[
x/(
(CDF[NormalDistribution[a,b],8]-CDF[NormalDistribution[a,b],1])/
(CDF[NormalDistribution[a,b],1]-CDF[NormalDistribution[a,b],0])
)
]


This is really just a math problem. Mathematica is providing the correct output based on your input.

The output you're asking for (in shorthand) is x/((CDF-CDF1)/(CDF-CDF1)). This can be rewritten as (CDF-CDF) * x / (CDF-CDF1). The numerator (CDF-CDF) goes somewhat slowly to 1/2 as k increases. The denominator (CDF-CDF1) rapidly goes to zero. When you have a small number in the denominator and a much larger number in the numerator, it explodes to infinity.

As k goes to zero, your output should converge to 7.0421, since the numerator and denominator are basically the same.

Here is some code to see what happens:

x = 7;
a[k_] := 1/2 Erfc[k/Sqrt]*x
q[k_] := a[k]/x
b[k_] := -q[k] Log[2, q[k]] - (1 - q[k]) Log[2, 1 - q[k]]
cdf[val_, k_] := CDF[NormalDistribution[a[k], b[k]], val]

(* Let's see what happens to your numerator and denominator *)
Plot[
{cdf[8, k] - cdf[0, k],
cdf[8, k] - cdf[1, k]},
{k, 0, 3},
AxesLabel -> {"k", "Value"},
PlotLegends ->
Placed[{"Numerator",
"Denominator"}, {Scaled[{0.95, 0.25}], {1, 0}}]]

(* Let's see what happens to the mean and standard deviation as k increases *)
Plot[
{a[k], b[k]},
{k, 0, 3},
AxesLabel -> {"k", "Value"},
PlotLegends ->
Placed[{"Mean (a)",
"Standard Deviation (b)"}, {Scaled[{0.9, 0.9}], {1, 1}}],
PlotRange -> Full]


You should see that the denominator (yellow curve) rapidly drops to zero, meaning your output value will explode to infinity. • Yes, you are correct. I have realized that I am asking for the wrong output. Thank you for helping! – sde7 Nov 24 '18 at 18:33
• No problem, glad it worked out for you! – MassDefect Nov 25 '18 at 1:56