1
$\begingroup$

Mathematica uses complementary error function and its inverse as functions for example when integral of a Gaussian is taken. Therefore, all output expressions of Mathematica involve Erfc and InverseErfc, if needed.

My question is: If there is an easy way to manipulate mathematica so that it outputs CDF of standard normal Gaussian distribution for Erfc and inverse CDF of standard Gaussian for InverseErfc?

I used the following and it should be working BUT I am not able to verify this!

Unprotect[Erfc];
Unprotect[InverseErfc];

Erfc[x_] := 2*(1 - f[x*Sqrt[2]])
InverseErfc[x_] := -ff[x/2]/Sqrt[2];

and then I use

FullSimplify[1/2 (1 - p0) Erfc[(-((Sqrt[n] (μ0 - μ1))/σ) + 
 Sqrt[2] InverseErfc[
   2 (1 + 1/
       2 (-2 + 
         Erfc[(Sqrt[2] n (μ0 - μ1)^2 - 
           Sqrt[2] σ^2 Log[(-1 + p0)^2/p0^2])/(
          4 Sqrt[n] (μ0 - μ1) σ)]))])/Sqrt[2]] + 1/2 p0 (2 - 
 Erfc[(Sqrt[2] n (μ0 - μ1)^2 - 
   Sqrt[2] σ^2 Log[(-1 + p0)^2/p0^2])/(
  4 Sqrt[n] (μ0 - μ1) σ)])]

and I only guess that the output is correct. But I connot confirm it. When I define later on

f[x_] := CDF[NormalDistribution[0, 1], x];
ff[x_] := InverseCDF[NormalDistribution[0, 1], x];

I got problems. Is the way I follow sound? How can I justify that Mathematica indeed fullsimplified correctly, I mean in terms of $f$ and $ff$.

$\endgroup$
2
  • 3
    $\begingroup$ Since CDF[NormalDistribution[]] includes Erfc, you're now defining f in terms of something which itself is now defined in terms of f. This can only lead to problems. Maybe use a replacement rule like {Erfc -> (2 f[-Sqrt[2] #] &)}? $\endgroup$ Mar 10, 2015 at 1:34
  • $\begingroup$ I would like to point you to a similar question I wrote about a different function Dot. I hope it will help: mathematica.stackexchange.com/questions/63147/… $\endgroup$
    – QuantumDot
    Jun 9, 2015 at 9:25

1 Answer 1

1
$\begingroup$

One complete overkill solution to the problem might be to use the Notation Package.

$\endgroup$
2
  • $\begingroup$ page does not exist. More explicitely? $\endgroup$ Mar 10, 2015 at 4:37
  • $\begingroup$ Sorry - try now. I'm new to stackexchange markup. $\endgroup$
    – iqchef
    Mar 11, 2015 at 5:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.