Post Reply 
(41/42) AGM - Arithmetic-Geometric Mean
06-10-2020, 08:02 AM
Post: #6
RE: (41/42) AGM - Arithmetic-Geometric Mean
If I can do AM=(a+b)/2 instead of a+(b-a)/2, and I test for GM convergence, then:

Code:
00 { 22-Byte Prgm }
01▸LBL 02
02 R↑
03▸LBL "AGM" @    a       b
04 ENTER
05 RCL+ ST Z
06 2
07 ÷ @            AM      a       b       b
08 R↓
09 ×
10 SQRT
11 X≠Y? @         GM      b       AM      AM
12 GTO 02
13 END

to make it 41-compatible, replace lines 4 and 5 with
RCL ST Y
RCL ST Y
+
at the expense of 1 byte.

If you don't like that the global label gets excuted in the loop, put it before LBL 02 and place a Rv in between, again at the expense of 1 byte

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
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 - Werner - 06-10-2020 08:02 AM



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