Post Reply 
(41/42) AGM - Arithmetic-Geometric Mean
06-10-2020, 04:10 AM (This post was last modified: 06-10-2020 04:21 AM by Gerson W. Barbosa.)
Post: #5
RE: (41/42) AGM - Arithmetic-Geometric Mean
15 steps, 31 bytes:

Code:

00 { 31-Byte Prgm }
01▸LBL "AGM"
02 STO ST T
03 X<>Y
04 +
05 2
06 STO÷ ST Y
07 X<> ST L
08 X=Y?
09 GTO 01
10 RCL× ST T
11 SQRT
12 GTO "AGM"
13▸LBL 01
14 R↓
15 END

Example:

agm(1 + 2i, 3 + 4i) + agm(5 + 6i, 7 + 8i)

1 ENTER 2 ⬏ COMPLEX 3 ENTER 4 ⬏ COMPLEX XEQ AGM
5 ENTER 6 ⬏ COMPLEX 7 ENTER 8 ⬏ COMPLEX XEQ AGM +



7.835947925677309435700566636717429 +
9.886442230519331091330438898700769i


P.S.: 42-only (the 41 lacks recall arithmetic).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (41/42) AGM - Arithmetic-Geometric Mean - Gerson W. Barbosa - 06-10-2020 04:10 AM



User(s) browsing this thread: 1 Guest(s)