Created
March 23, 2013 10:09
-
-
Save hiroshi-maybe/5227189 to your computer and use it in GitHub Desktop.
Generate infinite list of Newton-Raphson method
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
| repApply :: (a->a)->a->[a] | |
| repApply f x = x : repApply f (f x) | |
| newton :: Int -> [Double] | |
| newton n = repApply (\x -> (x+(fromIntegral n)/x)/2) 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment