Skip to content

Erf ​

The Gauss error function erf⁡(z)=2π∫0ze−t2 dt\operatorname{erf}(z) = \frac{2}{\sqrt\pi}\int_0^z e^{-t^2}\,dt, the shape behind the normal distribution's CDF.

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaError functionMathWorldErfWikidataQ579262DLMF7.2.E1FungrimErf✓Fungrim entryWolfram LanguageErf!
Erf(z)the Gauss error function erf⁡(z)\operatorname{erf}(z).
SageMatherf(z)SymPyerf(z)mpmatherf(z)Juliaenumeratio_ball(erf, z)Rusterf(z)
Typed signatures
TypePackageApplies
(complex | signed_infinity) -> complexcompute-enginealways
(number, number?) -> numberanalyticreplaces compute-enginealways

Domain: Special functions

Details
  • Odd function: erf⁡(−z)=−erf⁡(z)\operatorname{erf}(-z) = -\operatorname{erf}(z).
  • erf⁡(0)=0\operatorname{erf}(0) = 0, and erf⁡(±∞)=±1\operatorname{erf}(\pm\infty) = \pm 1 -- the total (signed) area under the Gaussian.
  • Complementary with Erfc: erf⁡(z)+erfc⁡(z)=1\operatorname{erf}(z) + \operatorname{erfc}(z) = 1.
  • Builds the normal CDF: Φ(x)=12(1+erf⁡(x/2))\Phi(x) = \frac{1}{2}\left(1 + \operatorname{erf}(x/\sqrt{2})\right).
  • compute-engine requires an inexact (floating-point) argument to produce a numeric value under plain evaluation; an exact integer or rational argument is left symbolic outside the special points 0 and ±∞\pm\infty.

Plot

Examples

Basic #
live ↗
Inerf⁡(0)\operatorname{erf}(0)Out00
live ↗
Inerf⁡(∞)\operatorname{erf}(∞)Out11
live ↗
Inerf⁡(−∞)\operatorname{erf}(-∞)Out−1-1

erf as z -> ComplexInfinity has no limit -- the approach direction decides it (1 real, i imaginary)

live ↗
Inerf⁡(∞~)\operatorname{erf}(\tilde∞)OutIndeterminate⁡\operatorname{Indeterminate}

A floating-point argument evaluates directly to a high-precision decimal

live ↗
Inerf⁡(0.5)\operatorname{erf}(0.5)Out0.520 499 877 813 046 537 6830.520\,499\,877\,813\,046\,537\,683

A machine-precision argument

live ↗
Inerf⁡(0.95)\operatorname{erf}(0.95)Out0.820 890 807 273 277 941 9080.820\,890\,807\,273\,277\,941\,908
Scope #

Threads element-wise over a list, as Wolfram's Listable heads do

live ↗
Inerf⁡([0,1])\operatorname{erf}(\bigl\lbrack0, 1\bigr\rbrack)Out[0,erf⁡(1)]\bigl\lbrack0, \operatorname{erf}(1)\bigr\rbrack

Complex arguments evaluate directly

live ↗
Inerf⁡(1.5−i)\operatorname{erf}(1.5-i)Out1.078 399 207 498 933 5+0.027 963 711 238 655 833i1.078\,399\,207\,498\,933\,5+0.027\,963\,711\,238\,655\,833i

Two arguments: the generalized erf⁡(z0,z1)=erf⁡(z1)−erf⁡(z0)\operatorname{erf}(z_0, z_1) = \operatorname{erf}(z_1) - \operatorname{erf}(z_0)

live ↗
Inerf⁡(0.5,1.5)\operatorname{erf}(0.5, 1.5)Out0.445 605 268 662 264 20.445\,605\,268\,662\,264\,2

...which with exact arguments is the difference erf⁡(2)−erf⁡(1)\operatorname{erf}(2) - \operatorname{erf}(1)

live ↗
Inerf⁡(1,2)\operatorname{erf}(1, 2)Outerf⁡(2)−erf⁡(1)\operatorname{erf}(2)-\operatorname{erf}(1)

Interval arithmetic: Erf is increasing, so the image of an interval is the interval of the endpoint images

live ↗
Inerf⁡(Interval(−2.1,−1.9))\operatorname{erf}(\mathrm{Interval}(-2.1, -1.9))OutInterval(−0.997 020 533 343 667,−0.992 790 429 235 257 5)\mathrm{Interval}(-0.997\,020\,533\,343\,667, -0.992\,790\,429\,235\,257\,5)

Uncertainty propagation, with slope 2πe−4\frac{2}{\sqrt\pi}e^{-4}

live ↗
Inerf⁡(Around(2,0.01))\operatorname{erf}(\mathrm{Around}(2, 0.01))OutAround(0.995 322 265 018 952 7,0.000 206 669 853 540 920 54)\mathrm{Around}(0.995\,322\,265\,018\,952\,7, 0.000\,206\,669\,853\,540\,920\,54)

To 40 significant digits, every one correctly rounded

live ↗
InN(erf⁡(1),40)N(\operatorname{erf}(1), 40)Out0.842 700 792 949 714 869 341 220 635 082 609 259 296 10.842\,700\,792\,949\,714\,869\,341\,220\,635\,082\,609\,259\,296\,1
Applications #

erf⁡(1/2)≈0.6827\operatorname{erf}(1/\sqrt2) \approx 0.6827: the '68' in the empirical 68-95-99.7 rule for one standard deviation

live ↗
Inerf⁡(0.707 106 781 186 547 6)\operatorname{erf}(0.707\,106\,781\,186\,547\,6)Out0.682 689 492 137 085 948 910.682\,689\,492\,137\,085\,948\,91

The standard normal CDF Φ(x)=12(1+erf⁡(x/2))\Phi(x) = \frac12(1 + \operatorname{erf}(x/\sqrt2)) at x=1.96x = 1.96: the familiar 97.5%

live ↗
In0.5×(1+erf⁡(1.962))0.5×(1+\operatorname{erf}(\frac{1.96}{\sqrt{2}}))Out0.975 002 104 851 779 565 863 50.975\,002\,104\,851\,779\,565\,863\,5
Properties #

Odd function: erf⁡(−z)=−erf⁡(z)\operatorname{erf}(-z) = -\operatorname{erf}(z), here at z=2z = 2

live ↗
Inerf⁡(2)+erf⁡(−2)=0\operatorname{erf}(2)+\operatorname{erf}(-2)=0OutTrue\mathrm{True}

Complementary with Erfc: erf⁡(z)+erfc⁡(z)=1\operatorname{erf}(z) + \operatorname{erfc}(z) = 1. See Erfc

live ↗
Inerf⁡(2)+erfc⁡(2)=1\operatorname{erf}(2)+\operatorname{erfc}(2)=1OutTrue\mathrm{True}

Oddness applied symbolically: erf⁡(−x)=−erf⁡(x)\operatorname{erf}(-x) = -\operatorname{erf}(x)

live ↗
Inerf⁡(−x)\operatorname{erf}(-x)Out−erf⁡(x)-\operatorname{erf}(x)

erf⁡(erfinv⁡(x))=x\operatorname{erf}(\operatorname{erfinv}(x)) = x symbolically. See ErfInv

live ↗
Inerf⁡(ErfInv(x))\operatorname{erf}(\mathrm{ErfInv}(x))Outxx

On the imaginary axis: erf⁡(i)=i erfi⁡(1)\operatorname{erf}(i) = i\,\operatorname{erfi}(1)

live ↗
Inerf⁡(i)\operatorname{erf}(i)OutiErfi(1)i\mathrm{Erfi}(1)

ddxerf⁡(x)=2πe−x2\frac{d}{dx}\operatorname{erf}(x) = \frac{2}{\sqrt\pi}e^{-x^2}, the Gaussian itself

live ↗
Inderf⁡(x)dx\frac{\mathrm{d}\operatorname{erf}(x)}{\mathrm{d}x}Out(2e−x2)/π(2e^{-x^2})/\sqrt{π}
Possible issues #

An exact integer argument is left unevaluated under plain evaluation -- pair with N() or use an inexact argument like 0.5 for a decimal

live ↗
Inerf⁡(1)\operatorname{erf}(1)Outerf⁡(1)\operatorname{erf}(1)

compute-engine's complex Erf runs in doubles, so past a double's 15 or so figures N leaves it unevaluated rather than print a double as 25.

live ↗
InN(erf⁡(1+i),25)N(\operatorname{erf}(1+i), 25)Outerf⁡(1+i)\operatorname{erf}(1+i)
Neat examples #

By z=3.5z=3.5, erf is already within 10−610^{-6} of its limit of 1

live ↗
Inerf⁡(3.5)\operatorname{erf}(3.5)Out0.999 999 256 901 627 658 5870.999\,999\,256\,901\,627\,658\,587
About
Examples24
Checked againstWolfram Language 21 agree3 differSageMath 17 agree2 differ1 unevaluatedSymPy 21 agree2 differmpmath 16 agree1 differJulia 15 agree1 differ1 errorRust 11 agree
CrosswalkWikipediaMathWorldWikidataDLMFFungrimFungrim entry ×9Wolfram LanguageSageMathSymPympmathJulia ×2Rust

Implementation

mappedsympypackages/oracle/src/mappings.ts
mappedsympypackages/oracle/src/mappings.ts

SymPy's erf2(x, y) is the same difference but stays unevaluated even at float arguments, so the difference is written out: erf(z1) - erf(z0), each term SymPy's own erf.

mappedmpmathpackages/oracle/src/mappings.ts
mappedmpmathpackages/oracle/src/mappings.ts
mappedsagepackages/oracle/src/mappings.ts
mappedjuliapackages/oracle/src/mappings.ts
mappedjuliapackages/oracle/src/mappings.ts
mappedrustpackages/oracle/src/mappings.ts

See also: Erfc, ErfInv