---
title: "Other Special Functions"
canonical: "https://docs.magma-maths.org/v2.30-1/BasicRings/RealAndComplexFields/special.html"
source: "https://docs.magma-maths.org/v2.30-1/BasicRings/RealAndComplexFields/special.md"
part: "Basic Rings"
chapter: "Real and Complex Fields"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Basic Rings", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/index-basic-rings.md"}
  - {"title": "Real and Complex Fields", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/RealAndComplexFields/index-real-and-complex-fields.md"}
prev: {"title": "The Hypergeometric Function", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/RealAndComplexFields/hypergeometric.md"}
next: {"title": "Summation of Infinite Series", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/RealAndComplexFields/infinite-summation.md"}
intrinsics:
  - {"name": "ArithmeticGeometricMean", "signature": "ArithmeticGeometricMean(x, y): RngSerElt, RngSerElt -> RngSerElt"}
  - {"name": "AGM", "signature": "AGM(f, g): RngSerElt, RngSerElt -> RngSerElt"}
  - {"name": "ArithmeticGeometricMean", "signature": "ArithmeticGeometricMean(x, y): FldReElt, FldReElt -> FldReElt"}
  - {"name": "AGM", "signature": "AGM(x, y): FldReElt, FldReElt -> FldReElt"}
  - {"name": "BernoulliNumber", "signature": "BernoulliNumber(n): RngIntElt -> FldRatElt"}
  - {"name": "BernoulliApproximation", "signature": "BernoulliApproximation(n): RngIntElt -> FldReElt"}
  - {"name": "DawsonIntegral", "signature": "DawsonIntegral(r): FldReElt -> FldReElt"}
  - {"name": "ErrorFunction", "signature": "ErrorFunction(r): FldReElt -> FldReElt"}
  - {"name": "Erf", "signature": "Erf(r): FldReElt -> FldReElt"}
  - {"name": "ComplementaryErrorFunction", "signature": "ComplementaryErrorFunction(r): FldReElt -> FldReElt"}
  - {"name": "Erfc", "signature": "Erfc(r): FldReElt -> FldReElt"}
  - {"name": "ExponentialIntegral", "signature": "ExponentialIntegral(r): FldReElt -> FldReElt"}
  - {"name": "ExponentialIntegralE1", "signature": "ExponentialIntegralE1(r): FldReElt -> FldReElt"}
  - {"name": "LogIntegral", "signature": "LogIntegral(r): FldReElt -> FldReElt"}
  - {"name": "ZetaFunction", "signature": "ZetaFunction(s): FldReElt -> FldReElt"}
  - {"name": "ZetaFunction", "signature": "ZetaFunction(R, n): FldRe, RngIntElt -> FldReElt"}
---

# Other Special Functions

<a id="function-arithmeticgeometricmean-rngserelt-rngserelt"></a>
## `ArithmeticGeometricMean(x, y): RngSerElt, RngSerElt -> RngSerElt`

<a id="function-agm-rngserelt-rngserelt"></a>
## `AGM(f, g): RngSerElt, RngSerElt -> RngSerElt`

Return the hyperbolic arithmetic-geometric mean of the series $f$ and $g$ defined over a field. The valuations of $f$ and $g$ must be equal.

<a id="function-arithmeticgeometricmean-fldreelt-fldreelt"></a>
## `ArithmeticGeometricMean(x, y): FldReElt, FldReElt -> FldReElt`

<a id="function-agm-fldreelt-fldreelt"></a>
## `AGM(x, y): FldReElt, FldReElt -> FldReElt`

Returns the arithmetic-geometric mean of the real or complex numbers $x$ and $y$, defined as the limit of either of the sequences $x_i, y_i$ where $x_0 = x$, $y_0 = y$, and $x_{i+1} = (x_i + y_i)/2, y_{i+1} = \sqrt{x_i y_i}$. The function calculates both sequences, and when the numbers are within the desired precision of each other, it returns one of them.

<a id="function-bernoullinumber-rngintelt"></a>
## `BernoulliNumber(n): RngIntElt -> FldRatElt`

For a non-negative integer $n$, return the value of the $n$-th Bernoulli number $B_n$, defined by

$$
{t\over e^t-1}=\sum_{n=0}^\infty B_n{t^n\over n!}.
$$

<a id="function-bernoulliapproximation-rngintelt"></a>
## `BernoulliApproximation(n): RngIntElt -> FldReElt`

For a non-negative integer $n$, return an approximation in the field of real numbers to the value of the $n$-th Bernoulli number $B_n$, defined by

$$
{t\over e^t-1}=\sum_{n=0}^\infty B_n{t^n\over n!}.
$$

<a id="function-dawsonintegral-fldreelt"></a>
## `DawsonIntegral(r): FldReElt -> FldReElt`

Given a real number $r$, compute the value of *Dawson’s integral*,

$$
e^{-x^2}\cdot\int_0^xe^{u^2} du,
$$

at $x = r$.

<a id="function-errorfunction-fldreelt"></a>
## `ErrorFunction(r): FldReElt -> FldReElt`

<a id="function-erf-fldreelt"></a>
## `Erf(r): FldReElt -> FldReElt`

Given a real number $r$, calculate the value of the *error function* ${\operatorname{erf}}$. This is the value of

$$
\sqrt{4\over \pi}\cdot \int_0^xe^{-u^2} du,
$$

at $x = r$ for $r>0$, and for $r<0$ it is defined by ${\operatorname{erf}}(x)=-{\operatorname{erf}}(-x)$, while ${\operatorname{erf}}(0)=0$.

<a id="function-complementaryerrorfunction-fldreelt"></a>
## `ComplementaryErrorFunction(r): FldReElt -> FldReElt`

<a id="function-erfc-fldreelt"></a>
## `Erfc(r): FldReElt -> FldReElt`

Given a real number $r$, calculate the value of the *complementary error function*. This is the value of $y = {\rm erfc}(x) = 1 - {\operatorname{erf}}(x)$ for the error function ${\operatorname{erf}}$ as defined above.

<a id="function-exponentialintegral-fldreelt"></a>
## `ExponentialIntegral(r): FldReElt -> FldReElt`

Given a real number $r$, calculate the value of the *exponential integral*, that is, the principal value of

$$
\int_{-\infty}^x{e^u\over u}du
$$

at $x = r$.

<a id="function-exponentialintegrale1-fldreelt"></a>
## `ExponentialIntegralE1(r): FldReElt -> FldReElt`

Given a real number $r$, calculate the value of the *exponential integral E1*, that is, the principal value of

$$
\int_x^{\infty}{e^{-u}\over u}du
$$

at $x = r$.

<a id="function-logintegral-fldreelt"></a>
## `LogIntegral(r): FldReElt -> FldReElt`

Given a non-negative real number $r$ that is not equal to 1, evaluate the *logarithmic integral* $y = {\operatorname{li}}(x)$ at $x = r$. This integral is defined to be the principal value of $\int_0^x{1\over \log(u)}du.$

<a id="function-zetafunction-fldreelt"></a>
## `ZetaFunction(s): FldReElt -> FldReElt`

<a id="function-zetafunction-fldre-rngintelt"></a>
## `ZetaFunction(R, n): FldRe, RngIntElt -> FldReElt`

These functions calculate values of the Riemann $\zeta$-function, which is the analytic continuation of

$$
\zeta(z)=\sum_{i=1}^\infty{1\over i^z}
$$

(convergent for Re$(z)> 1$). The version with one argument takes a real or complex number $r\neq 1$ and returns a real or complex number. The version with two arguments is much more restricted; it takes a real field $R$ and an integer $n \neq 1$, and returns $\zeta(n)$ in $R$.

MPFR uses the algorithm of Jean-Luc Rémy and Sapphorain Pétermann [[PR06](https://docs.magma-maths.org/v2.30-1/references.md#cite-pere06)].
