Created
November 4, 2017 16:54
-
-
Save xaviervia/9fe90fb9a9bc1bb6a788aa802cf7d0bf to your computer and use it in GitHub Desktop.
Riemann 𝜻 function in Idris, quick and dirty implementation for the rationals that prints information on each iteration
This file contains 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
riemannZeta : (s : Double) -> IO Double | |
riemannZeta s = riemannZetaStep s 1.0 0.0 | |
where riemannZetaStep : (s : Double) -> (n : Double) -> (p : Double) -> IO Double | |
riemannZetaStep s n p = | |
do let currentPower = pow n s | |
let currentFraction = 1.0 / currentPower | |
let currentValue = currentFraction + p | |
putStrLn ("s " ++ show s) | |
putStrLn ("n " ++ show n) | |
putStrLn ("power " ++ show currentPower) | |
putStrLn ("fraction " ++ show currentFraction) | |
putStrLn ("value " ++ show currentValue) | |
putStrLn "---" | |
riemannZetaStep s (n + 1.0) currentValue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment