Last active
December 14, 2025 21:21
-
-
Save arkiuat/776108f3a06100d2178c80170054bb14 to your computer and use it in GitHub Desktop.
Mueller's convergence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env raku | |
| # Mueller's convergence, from p. 14 of | |
| # https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf | |
| constant x0 = 4.FatRat; | |
| constant x1 = (4.25).FatRat; | |
| sub MAIN(Int $n) { | |
| say iter-oe $n; | |
| } | |
| sub oe(FatRat $y, FatRat $z --> FatRat) { | |
| 108.0 - ( 815.0 - 1500.0 / $z ) / $y | |
| } | |
| sub iter-oe(Int $n --> FatRat) { | |
| do given $n { | |
| when 0 { x0 } | |
| when 1 { x1 } | |
| when 2 { oe( x1, x0 ) } | |
| when 3 { oe( iter-oe(2), iter-oe(1) ) } | |
| default { oe( iter-oe($n-1), iter-oe($n-2) ) } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment