# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# `numeric`::`gaussAGM`

Gauss' arithmetic geometric mean

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```numeric::gaussAGM(`a`, `b`)
```

## Description

`numeric::gaussAGM(a, b)` computes the arithmetic geometric mean of the numbers a and b.

The iteration

with the starting values a0 = a, b0 = b converges quadratically to some value . This limit is called Gauss' arithmetic geometric mean of the starting values a, b.

If both arguments a and b can be converted to real or complex floating-point numbers, then a floating point value is computed and returned. Otherwise, the symbolic call ```numeric::gaussAGM(a, b)``` is returned.

If a = 0 or b = 0 or a + b = 0, then 0.0 is returned, even if a or b are symbolic objects.

The following relation to elliptic integrals holds for all complex values a and b:

`$\text{numeric::gaussAGM}\left(a,b\right)=\frac{\pi }{4}\frac{a+b}{\text{ellipticK}\left(\frac{{\left(a-b\right)}^{2}}{{\left(a+b\right)}^{2}}\right)}$`

## Environment Interactions

The function is sensitive to the environment variable `DIGITS`.

## Examples

### Example 1

A floating-point number is returned if the arguments can be converted to floating-point numbers:

`numeric::gaussAGM(0, 5)`

`numeric::gaussAGM(sqrt(2), PI)`

`numeric::gaussAGM(-10, PI)`

`numeric::gaussAGM(1 + I, 1 + 2*I)`

A symbolic call is returned if one of the arguments cannot be converted to a float:

`numeric::gaussAGM(1, b)`

For the special cases a = 0, b = 0 and a + b = 0, the result 0.0 is returned even for symbolic arguments:

`numeric::gaussAGM(a, 0)`

`numeric::gaussAGM(a, -a)`

## Parameters

 `a`, `b` arithmetical expressions

## Return Values

Floating point number or a symbolic call ```numeric::gaussAGM(a, b)```.