Sunday, September 22, 2019

The Error Function and Normal Distribution: Norm(x) and Erf(x)

The Error Function and Normal Distribution:  Norm(x) and Erf(x)

Introduction

The error function is defined as:

erf(x) = 2/√π * ∫( e^(-t^2) dt, 0, x)

norm(x) = 1/√(2*π) * ∫( e^(-z^2/2) dx, -∞, x)

We were assuming that the mean μ = 0 and variance σ = 1.

Derivation:  norm(x) in terms of erf(x)

norm(x)

= 1/√(2*π) * ∫( e^(-z^2/2) dx, -∞, x)

= 1/√(2*π) * ∫( e^(-z^2/2) dx, -∞, 0) + 1/√(2*π) * ∫( e^(-z^2/2) dx, 0, x)

= 1/2 + 1/√(2*π) * ∫( e^(-z^2/2) dx, 0, x)

-----------------------------
Substitution:

t^2 = z^2/2
t = z/√2
√2 * t = z
√2 dt = dz

z = 0,  t = 0
z = x,  t = x/√2
-----------------------------

= 1/2 + 1/√(2*π) * ∫( e^(-z^2/2) dx, 0, x)

= 1/2 + 1/√(2*π) * ∫(√2 *  e^(-t^2) dt, 0, x/√2)

 = 1/2 + 1/√π * √π/2 * 2/√π * ∫(√2 *  e^(-t^2) dt, 0, x/√2)

 = 1/2 + (1/√π * √π/2) * (2/√π * ∫(√2 *  e^(-t^2) dt, 0, x/√2))

 = 1/2 + 1/2 * 2/√π * ∫(√2 *  e^(-t^2) dt, 0, x/√2)

= 1/2 + 1/2 *erf(x/√2)

norm(x) = 1/2 + 1/2 *erf(x/√2)

norm(x) - 1/2 = 1/2 *erf(x/√2)

2 norm(x) - 1 = erf(x/√2)

Let t = x/√2, then:

2 norm(√2 * t) - 1 = erf(t)

Summary

norm(x) = 1/2 + 1/2 * erf(x/√2)

erf(t) = 2 * norm(√2 * t) - 1 

with μ = 0 and σ = 1.

Examples

norm(1) = 1/2 + 1/2 * erf(1/√2) ≈ 0.841344746069

erf(1) = 2 * norm(√2) - 1 ≈ 0.84270079295


Eddie

All original content copyright, © 2011-2019.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

TI-84 Plus CE Python: Traceable Plots in Python

TI-84 Plus CE Python: Traceable Plots in Python These two scripts are an easy way on how to create plots that are traceable. A tracea...