Post Reply 
(41/42) AGM - Arithmetic-Geometric Mean
06-09-2020, 11:55 PM
Post: #4
RE: (41/42) AGM - Arithmetic-Geometric Mean
Hi, Werner

I modified your code to test for convergence of GM instead
This meant AGM(x,0) will quit right the way.

Line 8 and line 14 changed, line 15 deleted.

Code:
00 { 27-Byte Prgm }                          
01▸LBL "AGM"
02 ENTER
03▸LBL 02 @     .       x       y       .
04 ENTER
05 - @          .       x       y       y
06 R↓
07 STO ST T @   x       y       y       x
08 STO+ ST Z  ; x       y       x+y     x
09 ×          ; xy      x+y     x
10 SQRT       ; GM      x+y     x
11 X<>Y       ; x+y     GM      x
12 2          ; 
13 ÷          ; AM      GM      x
14 X<> ST Z   ; x       GM     AM
15 X≠Y?       
16 GTO 02     
17 END
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 - Albert Chan - 06-09-2020 11:55 PM



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