(HP41) Iterated function with convergence to square root (Heron method)
|
04-25-2023, 03:21 PM
(This post was last modified: 04-27-2023 05:09 PM by floppy.)
Post: #1
|
|||
|
|||
(HP41) Iterated function with convergence to square root (Heron method)
Since RPN and FOCAL with it stack is efficient for iterated functions, here a posting of the iterated function of aN=(an + b/an) / 2 which result will be SQRT(b).
Other way to represent this is f(x,y)=(x+y/x,y). Then f(f(f(..(a0,b))))=(sqrt(b),b). The start value a0 can be anything (result will have the negativ sign if the start value a0<0). Nothing really new: - no register used in comparison to the programm available in page 11 in https://literature.hpcalc.org/community/...ram-de.pdf ) - start value can be defined (will be defined as b if a0=0) - no calculation done if b=0 Code: ; SQRT as iterated function, "möbius transform like" = only + * or / HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X |
|||
04-25-2023, 05:51 PM
(This post was last modified: 04-29-2023 01:22 PM by C.Ret.)
Post: #2
|
|||
|
|||
RE: (HP41) Iterated function with convergence to square root (Heron method)
Hi,
It reminds me of a program, using this exact method, written for a silly challenge on a French forum. (Look for MPO n°46 on Silicium). 001 LBL"HERON" RCL Y RCL Y / + 2 / END Usage: Enter the number b whose square root you want to determine. Press ENTER^. Optionally enter the approximation a0. Run the XEQ (ALPHA)HERON(ALPHA) program. A better approximation is displayed. Repeat the computation by pressing R/S . You will see the successive approximations quickly converging towards the square root of b. To extract another root, simply enter a new value, press ENTER^, enter an optional guess approximation and restart with R/S. Example: 2 FIX 9 2,000000000 1.5 XEQ (ALPHA)HERON(ALPHA) 1,416666667 R/S 1,414215687 R/S 1,414213563 R/S 1,414213563 ... |
|||
04-25-2023, 06:29 PM
Post: #3
|
|||
|
|||
RE: (HP41) Iterated function with convergence to square root (Heron method)
(04-25-2023 03:21 PM)floppy Wrote: - no register used in comparison to the program available in page 11 in https://literature.hpcalc.org/community/...ram-de.pdf ) Why not compare it to the program on the next page, which also doesn't use registers? |
|||
04-25-2023, 06:30 PM
Post: #4
|
|||
|
|||
RE: (HP41) Iterated function with convergence to square root (Heron method)
HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X |
|||
04-25-2023, 06:34 PM
(This post was last modified: 04-25-2023 06:36 PM by floppy.)
Post: #5
|
|||
|
|||
RE: (HP41) Iterated function with convergence to square root (Heron method)
(04-25-2023 06:29 PM)Thomas Klemm Wrote:correct. I missed this page 12. However, the program is with 2 variables = a bit different (the start value is something I will consider for another topic).(04-25-2023 03:21 PM)floppy Wrote: - no register used in comparison to the program available in page 11 in https://literature.hpcalc.org/community/...ram-de.pdf ) HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X |
|||
04-25-2023, 06:56 PM
Post: #6
|
|||
|
|||
RE: (HP41) Iterated function with convergence to square root (Heron method) | |||
04-25-2023, 07:20 PM
Post: #7
|
|||
|
|||
RE: (HP41) Iterated function with convergence to square root (Heron method) | |||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)