Error Function in LaTeX (\text{erf}(x))
- LaTeX command
\text{erf}(x)- Package
- Add to your preamble:
\usepackage{amsmath} - Mode
- Text and math mode
Where it is used
Error function: the scaled integral of the Gaussian e^{-t^2} from 0 to x, used for normal probabilities.
The definition is \text{erf}(x) = \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2}\,dt, with limits \pm 1 at \pm\infty. The standard normal CDF is \Phi(x) = \frac{1}{2}\big[1 + \text{erf}(x/\sqrt{2})\big], and erf solves the heat equation for a step initial condition. \text{erf} prints upright, but it follows the surrounding font, so it goes italic inside theorems; \operatorname{erf}, or a \DeclareMathOperator in the preamble, is more robust and adds proper spacing. It is odd: \text{erf}(-x) = -\text{erf}(x). The inverse is \text{erf}^{-1}, used to compute normal quantiles.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Error Function: $\text{erf}(x)$
\[ \Phi(x) = \frac{1}{2}\left[1 + \text{erf}\left(\frac{x}{\sqrt{2}}\right)\right] \]
\end{document}Related symbols
- Complementary Error
\text{erfc}(x) - Riemann zeta function
\zeta(s) - Bessel J
J_n(x) - Beta function
B(x, y) - Bessel Y
Y_n(x) - Gamma function
\Gamma(z)
Frequently asked questions
- How do I write Error Function in LaTeX?
- Type \text{erf}(x) in math mode, for example $\Phi(x) = \frac{1}{2}\left[1 + \text{erf}\left(\frac{x}{\sqrt{2}}\right)\right]$. Load amsmath first with \usepackage{amsmath}.
- Which package do I need for \text{erf}(x)?
- \text{erf}(x) needs amsmath: add \usepackage{amsmath} to your preamble before the document starts.
- Can I use \text{erf}(x) in text mode, or only in math mode?
- Both. \text{erf}(x) compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
Editor LaTeX AI Terbaik, Alternatif Overleaf
Octree membantu penyelidik dari 15+ universiti menulis kertas penyelidikan dengan lebih cepat menggunakan AI
- Jana diagram TikZ yang cantik menggunakan AI
- Muat naik imej dan tukar ke LaTeX dengan lancar
- Dapatkan bantuan segera untuk menulis dan memformat kertas penyelidikan