Created
November 15, 2012 05:26
-
-
Save Mathnerd314/4076804 to your computer and use it in GitHub Desktop.
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
import Numeric.Probability.Distribution(T,uniform,decons,norm) | |
import Data.Maybe(fromJust) | |
step :: T Rational Integer -> T Rational Integer | |
step x = norm $ do | |
cash <- x | |
if (cash == 0) then | |
return 0 | |
else do | |
f <- uniform [flip (-) 1, (*3)] | |
return (f cash) | |
result :: [T Rational Integer] | |
result = iterate step (return 1) | |
p :: [Rational] | |
p = map (fromJust . lookup 0 . decons) (tail result) | |
main = | |
mapM_ print $ (map fromRational p :: [Double]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment