1

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$.

LCarvalho
  • 9,233
  • 4
  • 40
  • 96
Seyhmus Güngören
  • 2,465
  • 1
  • 18
  • 19
  • 3
    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] #] &)}? – 2012rcampion Mar 10 '15 at 01:34
  • I would like to point you to a similar question I wrote about a different function Dot. I hope it will help: http://mathematica.stackexchange.com/questions/63147/how-to-re-parse-or-re-map-character-to-user-defined-function – QuantumDot Jun 09 '15 at 09:25

1 Answers1

1

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

iqchef
  • 111
  • 6