Enter your values
Arithmetic–Geometric Mean
Rounded for display. Copy full result for all calculated digits.
- Iterations
- 5
- Final relative gap
- 5.943e-34
- Tolerance
- 1.000e-20
- Input a
- 1
- Input b
- 2
Step-by-step calculation 3 steps
- 1
Start with A₀ = a and G₀ = b. Each step replaces the pair with its arithmetic mean and geometric mean.
- 2
Update Aₙ₊₁ = (Aₙ + Gₙ)/2 and Gₙ₊₁ = √(AₙGₙ) until their relative gap is at most 0.00000000000000000001.
- 3
The sequences converge to the same limit. Their final average is approximately 1.456791031046906869186432383265082 after 5 iterations.
Calculation table 6 rows
| Term | Value | Detail |
|---|---|---|
| 0 | 1 | G₀ = 2 |
| 1 | 1.5 | G1 = 1.414213562373095048801688724209698 · relative gap 0.057190958 |
| 2 | 1.457106781186547524400844362104849 | G2 = 1.456475315121970260851161882473252 · relative gap 0.00043336979 |
| 3 | 1.456791048154258892626003122289051 | G3 = 1.456791013939554946194175396981772 · relative gap 0.00000002348635 |
| 4 | 1.456791031046906919410089259635411 | G4 = 1.456791031046906818962775506894754 · relative gap 0.000000000000000068951079 |
| 5 | 1.456791031046906869186432383265082 | G5 = 1.456791031046906869186432383265082 · relative gap 0.00000000000000000000000000000000059428142 |
Understand the two sequences
Two linked sequences
Inspect the arithmetic and geometric updates at every iteration.
Precision control
Choose the relative gap that determines when the iteration stops.
Real-domain validation
The classical real AGM requires two positive starting values.
What is an arithmetic-geometric mean calculator?
The arithmetic-geometric mean (AGM) of two positive numbers is the common limit of two sequences. Starting with A₀ = a and G₀ = b, each new arithmetic term is the average of the previous pair, while each new geometric term is their square root product. Both sequences converge to the same value. The AGM is an iterative special mean, not the arithmetic mean or geometric mean taken once.
Important terms
- Arithmetic iterate Aₙ
- The sequence term formed by averaging the previous arithmetic and geometric iterates.
- Geometric iterate Gₙ
- The sequence term formed by taking the square root of the product of the previous pair.
- Convergence tolerance
- The maximum relative gap used to decide when the two sequences are sufficiently close.
- AGM
- The common limit approached by the arithmetic and geometric sequences.
When this method is useful
- Compute the classical arithmetic-geometric mean to a chosen numerical tolerance.
- Study convergence by comparing the arithmetic and geometric sequences at every step.
- Verify a numerical reference value such as AGM(1, 2).
- Explore how starting values affect the number of iterations needed.
Formula and variables
- a,b
- the two strictly positive starting values
- A_n
- the nth arithmetic sequence term
- G_n
- the nth geometric sequence term
- ε
- the selected relative convergence tolerance
At each iteration, compute both updates from the same previous pair. The arithmetic iterate stays above the geometric iterate; the gap shrinks until |Aₙ − Gₙ| / Aₙ is no larger than the selected tolerance. The displayed estimate is their final average.
Domain note: Both inputs must be strictly positive finite real numbers. Tolerance must be positive and no greater than 0.1; the iteration cap is 1–100. If the tolerance is not reached within that cap, the calculator reports that condition instead of presenting an unconverged value as final.
How to use this calculator
- 1
Set A₀ = a and G₀ = b using the two positive inputs.
- 2
Calculate Aₙ₊₁ = (Aₙ + Gₙ)/2.
- 3
Calculate Gₙ₊₁ = √(AₙGₙ) from the same previous pair.
- 4
Measure the relative gap |Aₙ₊₁ − Gₙ₊₁| / Aₙ₊₁.
- 5
Repeat until the gap meets the tolerance, then report the common-limit estimate and iteration count.
Step-by-step examples
Example 1
Problem: Approximate AGM(1, 2).
Substitution: A₀ = 1, G₀ = 2; A₁ = 1.5, G₁ = √2 ≈ 1.41421356; continue both updates
Result: 1.4567910310469069…
The two sequences converge toward this common value. The displayed digits depend on the selected tolerance.
Example 2
Problem: Find AGM(1, 4).
Substitution: A₁ = (1 + 4)/2 = 2.5; G₁ = √(1·4) = 2; then iterate
Result: ≈ 2.2430285803
The arithmetic and geometric iterates move toward one shared limit.
Example 3
Problem: Find AGM(5, 5).
Substitution: A₀ = G₀ = 5, so the sequences already agree
Result: 5
Equal positive inputs converge immediately without further iterations.
Rules, edge cases, and related ideas
Pairwise updates
Both next terms must use the same old Aₙ and Gₙ values.
Monotone bounds
The arithmetic sequence decreases while the geometric sequence increases unless they are already equal.
Tolerance-aware result
The output appears only after the computed relative gap reaches the requested threshold.
Edge cases and limitations
- Equal positive inputs return immediately with zero iterations.
- Zero or negative starting values are rejected because this implementation uses the classical positive-real AGM.
- A tolerance of zero is rejected because finite iteration cannot certify exact equality for unequal inputs.
- An insufficient iteration cap returns a clear convergence message rather than a partial answer.
How this differs from a related concept
The arithmetic mean and geometric mean each combine the original inputs once. The AGM repeatedly alternates these two averaging operations until their sequences meet, producing a distinct value that generally requires iteration.
Understand the result
For positive starting values, the AGM lies between the geometric mean and arithmetic mean of the original pair. The iteration table is useful for checking convergence; the tolerance controls the relative stopping gap, not a guarantee that every displayed trailing digit is correct beyond the internal precision.
Common mistakes
- Stopping after computing just one arithmetic and geometric mean.
- Using the updated arithmetic term when calculating the geometric term from that same iteration.
- Treating tolerance as a fixed number of decimal places.
- Assuming a non-converged last iterate is the AGM.
Frequently asked questions
What does AGM stand for?
Arithmetic-geometric mean. It is the shared limit of a coupled arithmetic and geometric iteration.
Why are two sequences calculated?
Each update uses both prior values: their arithmetic mean forms the next A term, and their geometric mean forms the next G term.
Can the inputs be zero or negative?
This calculator uses the classical positive-real definition and therefore requires both inputs to be strictly positive.
What does the tolerance control?
It sets the maximum relative gap between the current arithmetic and geometric iterates for stopping.
Why might the calculator report that tolerance was not reached?
The iteration limit may be too low for the requested tolerance. Increase the limit or choose a looser positive tolerance.